清空IE缓存-也就是清除掉IE临时文件夹

来源:互联网 发布:淘宝简单装修 编辑:程序博客网 时间:2024/05/01 23:24

引用WinINet单元 
procedureTForm1.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); 
ifdwEntrySize>0then 
lpEntryInfo^.dwStructSize:=dwEntrySize; 
hCacheDir:=FindFirstUrlCacheEntry(nil,lpEntryInfo^,dwEntrySize); 
ifhCacheDir<>0then 
begin 
repeat 
if(lpEntryInfo^.CacheEntryType)and(NORMAL_CACHE_ENTRY)=NORMAL_CACHE_ENTRYthen 
cachefile:=pchar(lpEntryInfo^.lpszSourceUrlName); 
cancheqqlist.Add(cachefile); 
fori:=0tocancheqqlist.Count-1do 
DeleteUrlCacheEntry(pchar(cancheqqlist.Strings[i]));//执行删除 
FreeMem(lpEntryInfo,dwEntrySize); 
dwEntrySize:=0; 
FindNextUrlCacheEntry(hCacheDir,TInternetCacheEntryInfo(nil^),dwEntrySize); 
GetMem(lpEntryInfo,dwEntrySize); 
ifdwEntrySize>0then 
lpEntryInfo^.dwStructSize:=dwEntrySize; 
untilnotFindNextUrlCacheEntry(hCacheDir,lpEntryInfo^,dwEntrySize); 
end; 
FreeMem(lpEntryInfo,dwEntrySize); 
FindCloseUrlCache(hCacheDir); 
cancheqqlist.Free; 
end;