function GetCookiesFolder:string;
var
pidl
ItemIDList;
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
---------------------------------------
老贴的,试试