利用Windows函数实现对IE的History列表的读取和删除其中的某些项:
http://www.applevb.com/sourcecode/delete%20history.zip
收藏夹你可以直接删除文件,至于对临时文件的操作,晚上给你代码。使用Windows API函数
基本上使用DeleteUrlCacheEntry 函数,你可以自己看一下。

解决方案 »

  1.   

    操控IE Cache的文章:
    建立一个新工程,然后在Form1中分别加入两个TButton组件以及两个TListBox组件,Form1的完整代码如下:unit Unit1;interfaceuses
      Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
      Wininet, StdCtrls;type
      TForm1 = class(TForm)
        Button1: TButton;
        ListBox1: TListBox;
        ListBox2: TListBox;
        Button2: TButton;
        procedure Button1Click(Sender: TObject);
        procedure Button2Click(Sender: TObject);
      private
        function FindNextEntrys(Handle:Integer):Boolean;
        { Private declarations }
      public
        { Public declarations }
      end;var
      Form1: TForm1;implementation{$R *.DFM}
    function TForm1.FindNextEntrys(Handle:Integer):Boolean;
    var
      T: PInternetCacheEntryInfo;
      D: DWORD;
    begin
      D := 0;
      FindnextUrlCacheEntryEx(Handle, nil, @D, nil, nil, nil);
      GetMem(T, D);
      try
        if FindNextUrlCacheEntryEx(Handle, T, @D, nil, nil, nil) then begin
          ListBox1.Items.Add(T.lpszSourceUrlName);
          ListBox2.Items.Add(T.lpszLocalFileName);
          Result := True;
        end
        else
          Result := False;
      finally
        FreeMem(T, D)
      end;
    end;procedure TForm1.Button1Click(Sender: TObject);
    var
      H:Integer;
      T: PInternetCacheEntryInfo;
      D: DWORD;
    begin
      D := 0;
      FindFirstUrlCacheEntryEx(nil, 0, NORMAL_CACHE_ENTRY, 0,nil,@D, nil, nil, nil);
      GetMem(T, D);
      try
        H := FindFirstUrlCacheEntryEx(nil,0, NORMAL_CACHE_ENTRY, 0, T, @D, nil, nil, nil);
        if (H = 0) then
        else begin
          repeat
          until not FindNextEntrys(H);
          FindCloseUrlCache(H);
        end
      finally
        FreeMem(T, D)
      end;
    end;procedure TForm1.Button2Click(Sender: TObject);
    var
      URL:String;
    begin
      If ListBox1.ItemIndex >=0 then begin
        URL:=ListBox1.Items.Strings[ListBox1.ItemIndex];
        Self.Caption := URL;
        if DeleteUrlCacheEntry(PChar(URL))then
          ListBox1.Items.Delete(ListBox1.ItemIndex);
      end;
    end;end.    运行程序,点击Button1,就可以分别在ListBox1中列出所有在Cache中的文件所对应的URL以及在ListBox2中列出相应的文件名。在ListBox1中选择一个列表,然后点击 Button2 就可以将该项从Cache中删除。
        下面看程序,FindFirstUrlCacheEntryEx函数在Delphi中定义如下:function FindFirstUrlCacheEntryExA(lpszUrlSearchPattern: PAnsiChar;
        dwFlags: DWORD;
        dwFilter: DWORD;
        GroupId: GROUPID;
        lpFirstCacheEntryInfo: PInternetCacheEntryInfo;
        lpdwFirstCacheEntryInfoBufferSize: LPDWORD;
        lpGroupAttributes: Pointer;  { 必须为 nil }
        pcbGroupAttributes: LPDWORD;    {必须为 nil }
        lpReserved: Pointer             { 必须为 nil }
        ): THandle; stdcall;    其中,dwFilter定义查找类型,在这里定义为NORMAL_CACHE_ENTRY以查找普通的Cache文件,GroupId定义查找分组,在这里定义为0以查找所有分组。lpFirstCacheEntryInfo定义Cache文件数据结构。该结构在Wininet.pas中有定义,这里就不列出了,其中成员lpszSourceUrlName以及lpszLocalFileName分别定义文件URL以及本地文件名。
        在上面的程序中我们可以看到,不论调用FindFirstUrlCacheEntryEx还是FindNextUrlCacheEntryEx,都需要调用两次,第一次获得一个指向PInternetCacheEntryInfo结构的指针,将这个指针通过GetMem函数赋予一个PInternetCacheEntryInfo结构数据。然后第二次调用才可以获得结果。遍历访问完毕后需要调用FindCloseUrlCache方法关闭打开的局柄。
        上面介绍的是Cache操作中的遍历Cache文件以及删除Cache文件的操作。Cache操作函数还包括:分组函数,可以将特定的文件分在一个组内并执行组操作,例如:CreateUrlCacheGroup、SetUrlCacheEntryGroup;数据流(Stream)操作函数,可以将Cache中的内容输入到数据流中。等等。
      

  2.   


    收藏家:只要找到目录(windows安装目录),kill就完了
      

  3.   

    为什么要这么复杂,对文件KILL不就行了