怎么清除IE的COOK记录 怎么清除IE的COOK记录。绝对是不能用遍历清清除就是了,我看过一本书,可惜忘了。谢谢大家。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Delphi下深入Windows核心编程》这本书上讲了,你去找找 http://www.vckbase.com/document/viewdoc.asp?id=280 清除IE记录unit Unit1;interfaceuses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls,Registry,wininet,FileCtrl,shlobj,shellapi;type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); private { Private declarations } public { Public declarations } end;var Form1: TForm1;implementation{$R *.DFM}procedure DelRegCache;var reg:TRegistry;begin reg:=Tregistry.create; reg.RootKey:=HKEY_CURRENT_USER; reg.DeleteKey('Software\Microsoft\Internet Explorer\TypedURLs'); reg.Free;end;function GetCookiesFolder:string;var pidl:pItemIDList; buffer:array [ 0..255 ] of char ;begin SHGetSpecialFolderLocation( application.Handle , 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; ShellDeleteFile(dir+'\*.txt');end;procedure DelHistory;var lpEntryInfo: PInternetCacheEntryInfo; hCacheDir: LongWord ; dwEntrySize, dwLastError: LongWord;begin dwEntrySize := 0; FindFirstUrlCacheEntry(nil, TInternetCacheEntryInfo(nil^), dwEntrySize); GetMem(lpEntryInfo, dwEntrySize); hCacheDir := FindFirstUrlCacheEntry(nil, lpEntryInfo^, dwEntrySize); if hCacheDir <> 0 then DeleteUrlCacheEntry(lpEntryInfo^.lpszSourceUrlName); FreeMem(lpEntryInfo); repeat dwEntrySize := 0; FindNextUrlCacheEntry(hCacheDir, TInternetCacheEntryInfo(nil^), dwEntrySize); dwLastError := GetLastError(); if dwLastError = ERROR_INSUFFICIENT_BUFFER then //如果成功 begin GetMem(lpEntryInfo, dwEntrySize); {分配dwEntrySize字节的内存} if FindNextUrlCacheEntry(hCacheDir, lpEntryInfo^, dwEntrySize) then DeleteUrlCacheEntry(lpEntryInfo^.lpszSourceUrlName); FreeMem(lpEntryInfo); end; until (dwLastError = ERROR_NO_MORE_ITEMS);end;procedure TForm1.Button1Click(Sender: TObject);begin try screen.cursor:=crHourGlass; DelRegCache; DelCookie; DelHistory; finally screen.cursor:=crDefault; end;end;end. 今天认识个朋友开心(散分1) 动态添加listview节点问题 怎么老说我没定义窗体类? 效率,效率!dbf 插入 oracle 关于TAB键的简单问题 谁有d6 的条码控件。 送分 DELPHI 4 从入门到精通用什么东东解压呀`` 小妹?^_^?:捉虫:求时间段的函数? 怎样实现控件之间的拖动(drag)? 怎么清除ie的缓存? 已知一个字符变量名内保存一个控件点,怎么使用这个控件呢?
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls,Registry,wininet,FileCtrl,shlobj,shellapi;type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;var
Form1: TForm1;implementation{$R *.DFM}
procedure DelRegCache;
var
reg:TRegistry;
begin
reg:=Tregistry.create;
reg.RootKey:=HKEY_CURRENT_USER;
reg.DeleteKey('Software\Microsoft\Internet Explorer\TypedURLs');
reg.Free;
end;function GetCookiesFolder:string;
var
pidl:pItemIDList;
buffer:array [ 0..255 ] of char ;
begin
SHGetSpecialFolderLocation(
application.Handle , 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;
ShellDeleteFile(dir+'\*.txt');
end;procedure DelHistory;
var
lpEntryInfo: PInternetCacheEntryInfo;
hCacheDir: LongWord ;
dwEntrySize, dwLastError: LongWord;
begin
dwEntrySize := 0;
FindFirstUrlCacheEntry(nil, TInternetCacheEntryInfo(nil^), dwEntrySize);
GetMem(lpEntryInfo, dwEntrySize); hCacheDir := FindFirstUrlCacheEntry(nil, lpEntryInfo^, dwEntrySize);
if hCacheDir <> 0 then
DeleteUrlCacheEntry(lpEntryInfo^.lpszSourceUrlName);
FreeMem(lpEntryInfo); repeat
dwEntrySize := 0;
FindNextUrlCacheEntry(hCacheDir, TInternetCacheEntryInfo(nil^),
dwEntrySize);
dwLastError := GetLastError();
if dwLastError = ERROR_INSUFFICIENT_BUFFER then //如果成功
begin
GetMem(lpEntryInfo, dwEntrySize); {分配dwEntrySize字节的内存}
if FindNextUrlCacheEntry(hCacheDir, lpEntryInfo^, dwEntrySize) then
DeleteUrlCacheEntry(lpEntryInfo^.lpszSourceUrlName);
FreeMem(lpEntryInfo);
end;
until (dwLastError = ERROR_NO_MORE_ITEMS);
end;procedure TForm1.Button1Click(Sender: TObject);
begin
try
screen.cursor:=crHourGlass;
DelRegCache;
DelCookie;
DelHistory;
finally
screen.cursor:=crDefault;
end;
end;end.