AI摘要

本文提供了一个DelCookie过程,用于删除Cookies文件。首先,通过GetCookiesFolder函数获取Cookies文件夹路径,然后使用ShellDeleteFile函数删除该路径下的所有.txt文件。需要在USER单元中加入WinINet、shlobj和shellapi三个库。
本文提供了一个Del

function GetCookiesFolder:string;
var
   pidl:pItemIDList;
   buffer:array [ 0..255 ] of char ;
begin
  SHGetSpecialFolderLocation(0, CSIDL_COOKIES, pidl);
  SHGetPathFromIDList(pidl, buffer);
  result:=strpas(buffer);
end; 

 
function ShellDeleteFile(sFileName: string): Boolean;
var
 FOS: TSHFileOpStruct;
begin
  FillChar(FOS, SizeOf(FOS), 0); {记录清零}
  with FOS do
  begin
      wFunc := FO_DELETE;//删除
      pFrom := PChar(sFileName);
      fFlags := FOF_NOCONFIRMATION;
  end;
  Result := (SHFileOperation(FOS) = 0);
end; 

 
procedure DelCookie;
var
  dir:string;
begin
  InternetSetOption(nil, INTERNET_OPTION_END_BROWSER_SESSION, nil, 0);
  dir:=GetCookiesFolder;
  //showmessage(dir);
  ShellDeleteFile(dir+'\*.txt');
end;

在USER里面加入如下单元;
WinINet,shlobj,shellapi

※相关文章推荐※



最后修改:2009 年 08 月 16 日
点赞的人是最酷的