www.pudn.com > delete-ie-files.rar > Unit1.pas, change:2010-04-10,size:1529b


unit Unit1; 
 
interface 
 
uses 
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, 
  Dialogs, WinInet, RzButton; 
 
type 
  TForm1 = class(TForm) 
    RzBitBtn1: TRzBitBtn; 
    procedure RzBitBtn1Click(Sender: TObject); 
  private 
    { Private declarations } 
  public 
    { Public declarations } 
  end; 
 
var 
  Form1: TForm1; 
 
implementation 
 
{$R *.dfm} 
 
procedure DeleteIECache; 
var 
  lpEntryInfo: PInternetCacheEntryInfo;  
  hCacheDir: LongWord;  
  dwEntrySize: LongWord;  
begin  
  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  
      DeleteUrlCacheEntry(lpEntryInfo^.lpszSourceUrlName);  
      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); 
end; 
 
procedure TForm1.RzBitBtn1Click(Sender: TObject); 
begin 
  if MessageBox(Handle, 'ȷҪɾ', 'ɾ', MB_YESNO) = MRYES then 
    DeleteIECache; 
end; 
 
end.