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 日
© 允许规范转载
相关文章
- 无相关文章
4 条评论
你需要设置要删除缓存的域名才行,用embd的组件吧,那个是专作IE开发的。
[quote=冬雷软件]效果是有,不过进入死循环。[/quote]
可以啊。
效果是有,不过进入死循环。
运行后一点效果都没有哦