F
fima
Unregistered / Unconfirmed
GUEST, unregistred user!
我在别的地方找的来个方法,一个使用ShellAPI做,但是好似不能实现
另外一个方法如下:
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)); //执行删除
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;
这个能实现但是速度很慢,基本上5000零时个文件要卡30秒左右,这样就没有什么意义了 = =
我看到别人的程序删除的时候一点也不卡....不知道怎么实现的,有哪位高人能够告知小弟,不胜感激
还有,这个Temporary Internet Files文件夹个结构有些奇怪,有时会出现二级目录,但是在窗口下面是看不到二级目录的,而用遍历的方法然后showmessage却能看到二级目录....真不明白
另外一个方法如下:
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)); //执行删除
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;
这个能实现但是速度很慢,基本上5000零时个文件要卡30秒左右,这样就没有什么意义了 = =
我看到别人的程序删除的时候一点也不卡....不知道怎么实现的,有哪位高人能够告知小弟,不胜感激
还有,这个Temporary Internet Files文件夹个结构有些奇怪,有时会出现二级目录,但是在窗口下面是看不到二级目录的,而用遍历的方法然后showmessage却能看到二级目录....真不明白