删除internet临时文件_Delphi

  • 内容
  • 评论
  • 相关

uses wininet

procedure TForm1.Button1Click(Sender: TObject);
var
lpEntryInfo: PInternetCacheEntryInfo;
hCacheDir: LongWord (*Handle*);
dwEntrySize, dwLastError: LongWord;
begin
//Get size of first entry in dwEntrySize
dwEntrySize := 0;

http://www.gaodaima.com/?p=65881删除internet临时文件_Delphi

FindFirstUrlCacheEntry(nil, TInternetCacheEntryInfo(nil^), dwEntrySize);
//Create structure that can hold entry
GetMem(lpEntryInfo, dwEntrySize);
//Get first cache entry and handle to retrieve next entry, output url
hCacheDir := FindFirstUrlCacheEntry(nil, lpEntryInfo^, dwEntrySize);
if hCacheDir <> 0 then
   Memo1.Lines.Add(string(lpEntryInfo^.lpszSourceUrlName));

   //Use this line to Delete
   {DeleteUrlCacheEntry(lpEntryInfo^.lpszSourceUrlName);}

//free structure
FreeMem(lpEntryInfo);

//retrieve all subsequent entries
repeat
   dwEntrySize := 0;
   FindNextUrlCacheEntry(hCacheDir, TInternetCacheEntryInfo(nil^), dwEntrySize);
   dwLastError := GetLastError();
   if GetLastError = ERROR_INSUFFICIENT_BUFFER then begin
     GetMem(lpEntryInfo, dwEntrySize);
     if FindNextUrlCacheEntry(hCacheDir, lpEntryInfo^, dwEntrySize) then
       Memo1.Lines.Add(string(lpEntryInfo^.lpszSourceUrlName));
     FreeMem(lpEntryInfo);
   end;
until dwLastError = ERROR_NO_MORE_ITEMS;
end; 

欢迎大家阅读《删除internet临时文件_Delphi》,跪求各位点评,若觉得好的话请收藏本文,by 搞代码

原创文章,转载请注明: 转载自搞代码

本文链接地址: 删除internet临时文件_Delphi

微信支付二维码

微信 赏一包辣条吧~

支付宝支付二维码

支付宝 赏一听可乐吧~

评论

0条评论

发表评论

电子邮件地址不会被公开。 必填项已用*标注