哈哈,刚编完!
procedure TForm1.Button1Click(Sender: TObject);
var P:PChar;
 var FileOP:TSHFILEOPSTRUCT;
begin
        GetMem(P,200);
        SHGetSpecialFolderPath(0,p,CSIDL_COMMON_FAVORITES,False);
        ShowMessage(Strpas(P));
    FileOp.wnd:=Handle;
    FileOp.wFunc:=FO_Delete;
    FileOp.pFrom:=p;
    FileOp.fFlags:=FOF_ALLOWUNDO;
    //这个参数参考MSDN
    FileOp.hNameMappings:=nil;
    FileOp.lpszProgressTitle:=nil;
    SHFileOperation(FileOp);
end;

解决方案 »

  1.   

    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中删除。
      

  2.   

    http://www.csdn.net/expert/topic/245/245113.shtm
      

  3.   

    ch81(missile)的程序运行的时候会出错!!显示为存取错误之类,问题好像出自
    SHFileOperation(FileOp);不信你自己试试哟!?高手你自己没有调试过嘛?!!
    就丢上来,还不如在注册表中找到需要的目录,在进行处理起来比较简单哟……
      

  4.   

    哈哈,不好意思,我是裸写的,写的时候,知道原理是没错的。
    下面刚调试过。
     uses Shlobj,Shellapi;
    procedure TForm1.Button1Click(Sender: TObject);
    var P:PChar;
    var Str:String;
    var P1:Pchar;
    var FileOP:TSHFILEOPSTRUCT;
    begin
            GetMem(P,200);
            SHGetSpecialFolderPath(0,p,CSIDL_COMMON_FAVORITES,False);
            Str:=StrPas(p)+'\*.*';
            ShowMessage(Str);
          GetMem(p1,200);
          StrpCopy(p1,str);
          ShowMessage(StrPas(p1));
        //    ShowMessage(Strpas(P));
        FileOp.wnd:=0;
        FileOp.wFunc:=FO_Delete;
        FileOp.pFrom:=p1;
        FileOp.pTo:=nil;
        FileOp.fFlags:=FOF_ALLOWUNDO;
        //这个参数参考MSDN
        FileOp.hNameMappings:=nil;
        FileOp.lpszProgressTitle:=nil;
        FileOp.fAnyOperationsAborted:=True;
        FileOp.lpszProgressTitle:=nil;
        SHFileOperation(FileOp);end;