如何用VB清理上网产生的cookies

cookies里存有户用名和密码.我要用VB清理掉.最好给代码.1.2楼的方法都不行.再打开网站的时候Login还是存在.Cookie:Tracker=JEuWPvS1O... cookies里存有户用名和密码.我要用VB清理掉.最好给代码.
1.2楼的方法都不行.再打开网站的时候Login还是存在.
Cookie: Tracker=JEuWPvS1OzYJUHawewOpPRKO2ZApVeWt;Login=ZXKBGyELGcp9EuDpUgfQCTF___dyX$wgKsP5ro25v4fNtMEj$XTMQKJsGsbhbCyX___qsKQ8WXd7tp8=

Cookie: Tracker=JEuWPvS1OzYJUHawewOpPRKO2ZApVeWt 这种才是我想要的
展开
 我来答
匿名用户
2009-03-25
展开全部
正在使用的当然不能删除了。~

Option Explicit
Private Const NO_ERROR = 0
Private Const INTERNET_OPTION_END_BROWSER_SESSION = 42
Private Const CSIDL_COOKIES = &H21&
Private Type SHITEMID
cb As Long
abID As Byte
End Type
Private Type ITEMIDLIST
mkid As SHITEMID
End Type
Private Declare Function ShellAbout Lib "shell32.dll" Alias "ShellAboutA" (ByVal hWnd As Long, ByVal szApp As String, ByVal szOtherStuff As String, ByVal hIcon As Long) As Long
Private Declare Function SHGetSpecialFolderLocation Lib "shell32.dll" (ByVal hwndOwner As Long, ByVal nFolder As Long, pidl As ITEMIDLIST) As Long
Private Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias "SHGetPathFromIDListA" (ByVal pidl As Long, ByVal pszPath As String) As Long
Private Declare Function InternetSetOption Lib "wininet.dll" Alias "InternetSetOptionA" (ByVal hInternet As Long, ByVal dwOption As Long, ByRef lpBuffer As Any, ByVal dwBufferLength As Long) As Long

Private Function GetSpecialfolder(CSIDL As Long) As String
Dim r As Long
Dim IDL As ITEMIDLIST
'Get the special folder
Dim path As String
r = SHGetSpecialFolderLocation(100, CSIDL, IDL)
If r = NO_ERROR Then
'Create a buffer
path = Space$(512)
'Get the path from the IDList
r = SHGetPathFromIDList(ByVal IDL.mkid.cb, ByVal path$)
'Remove the unnecessary chr$(0)'s
GetSpecialfolder = Left$(path, InStr(path, Chr$(0)) - 1)
Exit Function
End If
GetSpecialfolder = ""
End Function

Private Sub Command1_Click()
Dim CookiesPath As String
CookiesPath = GetSpecialfolder(CSIDL_COOKIES) '获取COOKIES文件夹路径
'为了防止在ie打开时,内存中还有部分COOKIES存在,加了下面这句
Call InternetSetOption(0, INTERNET_OPTION_END_BROWSER_SESSION, ByVal 0&, 0)
Kill CookiesPath + "\*.txt" '全部删除,如果需要删除某一个COOKIES的话,需要用dir或fso枚举出所有文件,然后用kill语句删除
End Sub

这样做会更安全一点~
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
理发工具
2009-03-25 · TA获得超过441个赞
知道小有建树答主
回答量:672
采纳率:100%
帮助的人:510万
展开全部
Private Sub Form_Load()
Kill "C:\Documents and Settings\用户名\Cookies\*"
End Sub

把用户名替换为你的用户名。
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式