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 日
卧槽,全是白嫖客,服务器不要钱吗?