跳过度娘的防御机制

熟悉么?反正我是烦透了!不管他是个什么玩意,暂且把它叫做度娘的防御机制。它很烦?跳过它!怎么跳?看代码:

procedure DeleteIECache(httpStr: string); // 清理IE缓存,IE.cookies
var  
  lpEntryInfo: PInternetCacheEntryInfo;   
  hCacheDir: LongWord;   
  dwEntrySize: LongWord;   
  cachefile: string;   
begin  
  dwEntrySize := 0;
  FindFirstUrlCacheEntry(nil, TInternetCacheEntryInfo(nil^), dwEntrySize);   
  GetMem(lpEntryInfo, dwEntrySize);   
  if dwEntrySize > 0 then
    lpEntryInfo^.dwStructSize := dwEntrySize;
  hCacheDir := FindFirstUrlCacheEntry(nil, lpEntryInfo^, dwEntrySize);
  if hCacheDir <> 0 then  
  begin  
    repeat  
      if (lpEntryInfo^.CacheEntryType) and (NORMAL_CACHE_ENTRY) = NORMAL_CACHE_ENTRY then
        cachefile := pchar(lpEntryInfo^.lpszSourceUrlName);
      if pos(httpStr, cachefile) > 0 then    //清除特定网站的cookies.例如baidu.com
        DeleteUrlCacheEntry(pchar(cachefile)); //执行删除操作   
      FreeMem(lpEntryInfo, dwEntrySize);
      dwEntrySize := 0;
      FindNextUrlCacheEntry(hCacheDir, TInternetCacheEntryInfo(nil^), dwEntrySize);   
      GetMem(lpEntryInfo, dwEntrySize);   
      if dwEntrySize > 0 then  
        lpEntryInfo^.dwStructSize := dwEntrySize;   
    until not FindNextUrlCacheEntry(hCacheDir, lpEntryInfo^, dwEntrySize);   
  end;   
  FreeMem(lpEntryInfo, dwEntrySize);   
  FindCloseUrlCache(hCacheDir);   
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  DeleteIECache(Edit1.Text);
end;

  熟悉么?只要百度过"delphi 删除cookies"  都应该看到过,不错,我抄来的。仅几句代码,就可以去掉度娘的衣杉(风韵犹存呐!口水)!

但是我要总结的是:我是个SB,对,是这样的。上面的代码在百度知道里面存了N年,我也看到过N次,但是我不相信他,反而去用那些一长串的代码,觉得长才专业,网上转那些无用代码的相当多,实际上没用!

好了,再给我这种菜鸟说一句:先调用DeleteIECache('baidu.com');再用个从爱好的webbrowser.go() 或者 idhttp.get() 或者......(本人真菜,不知道还有什么了)

相关文章:

  • 2021-08-30
  • 2022-12-23
  • 2021-11-15
  • 2021-07-23
  • 2021-08-26
  • 2021-07-20
  • 2021-10-07
猜你喜欢
  • 2021-07-09
  • 2021-11-12
  • 2021-09-06
  • 2021-08-31
  • 2022-12-23
  • 2022-12-23
  • 2021-11-01
相关资源
相似解决方案