删除IE临时文件

Develop · 2006-07-10 · 11857 人浏览

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;

取消回复
  1. samool 2007-12-01

    你需要设置要删除缓存的域名才行,用embd的组件吧,那个是专作IE开发的。

  2. samool 2007-12-01

    [quote=冬雷软件]效果是有,不过进入死循环。[/quote]
    可以啊。

  3. 冬雷软件 2007-12-01

    效果是有,不过进入死循环。

  4. ww 2006-10-15

    运行后一点效果都没有哦

Theme Jasmine by Kent Liao