uses
 WinInet;

procedure DeleteIECache; //清理IE缓存
var
 lpEntryInfo: PInternetCacheEntryInfo;
 hCacheDir: LongWord;
 dwEntrySize: LongWord;
 cachefile: string;
 i: integer;
 cancheqqlist: TStringList;
begin
 cancheqqlist := TStringList.Create;
 cancheqqlist.Clear;
 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('Delphibbs.com', cachefile) > 0 then //符合条件的清除
       cancheqqlist.Add(cachefile);
     for i := 0 to cancheqqlist.Count - 1 do
       DeleteUrlCacheEntry(pchar(cancheqqlist.Strings[i])); //执行删除
     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);
 cancheqqlist.Free;
end;

  • 相关文章

    • 无相关文章
最后修改:2009 年 08 月 16 日
卧槽,全是白嫖客,服务器不要钱吗?