delphi 删除Cookies文件


本文整理自网络,侵删。

 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

相关阅读 >>

Delphi createmessagedialog

Delphi 访问https图片

Delphi httpencode

Delphi静态和动态调用dll的实例

Delphi中窗体的方法

Delphi keydown与keyup、keypress的区别

Delphi xe10对json的解析应用

Delphi idhttp上传图给asp完美解决

Delphi firemonkey应用程序中显示时隐藏虚拟键盘

Delphi webbrowser控件属性

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...