这是mainfromunit.DFM
object MainForm: TMainForm
Left = 192
Top = 107
BorderStyle = bsDialog
Caption = 'Explorer Cookies'
ClientHeight = 413
ClientWidth = 437
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'Tahoma'
Font.Style = []
OldCreateOrder = False
Position = poScreenCenter
OnShow = FormShow
PixelsPerInch = 96
TextHeight = 13
object Label1: TLabel
Left = 8
Top = 8
Width = 84
Height = 13
Caption = '&Explorer Cookies:'
FocusControl = ListBox1
end
object Label2: TLabel
Left = 8
Top = 192
Width = 26
Height = 13
Caption = '&Text:'
FocusControl = Memo1
end
object ListBox1: TListBox
Left = 8
Top = 24
Width = 425
Height = 161
ItemHeight = 13
PopupMenu = CookiesPopup
TabOrder = 0
OnClick = ListBox1Click
end
object Memo1: TMemo
Left = 8
Top = 208
Width = 425
Height = 177
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -13
Font.Name = 'Courier'
Font.Style = []
Lines.Strings = (
'Memo1')
ParentFont = False
ScrollBars = ssVertical
TabOrder = 1
end
object Actions: TActionList
Left = 8
Top = 384
object LoadCookies: TAction
Caption = '&Load Cookies'
OnExecute = LoadCookiesExecute
end
object DeleteCookie: TAction
Caption = '&Delete Cookie'
OnExecute = DeleteCookieExecute
OnUpdate = DeleteCookieUpdate
end
object SearchCookie: TAction
Caption = '&Search Cookie...'
OnExecute = SearchCookieExecute
end
end
object CookiesPopup: TPopupMenu
Left = 40
Top = 384
object DeleteCookiePopup: TMenuItem
Action = DeleteCookie
end
object LoadCookiesPopup: TMenuItem
Action = LoadCookies
end
object SearchCookie1: TMenuItem
Action = SearchCookie
end
end
end
这是mainfromunit.PAS
unit MainFormUnit;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ActnList, Menus;
type
TMainForm = class(TForm)
Label1: TLabel;
Label2: TLabel;
ListBox1: TListBox;
Memo1: TMemo;
Actions: TActionList;
LoadCookies: TAction;
CookiesPopup: TPopupMenu;
DeleteCookie: TAction;
DeleteCookiePopup: TMenuItem;
LoadCookiesPopup: TMenuItem;
SearchCookie: TAction;
SearchCookie1: TMenuItem;
procedure LoadCookiesExecute(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure ListBox1Click(Sender: TObject);
procedure DeleteCookieUpdate(Sender: TObject);
procedure DeleteCookieExecute(Sender: TObject);
procedure SearchCookieExecute(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
Folder: string;
end;
var
MainForm: TMainForm;
implementation
uses Registry;
{$R *.DFM}
function CookieFolder: string;
const
SCookieKey = '/Software/Microsoft/Windows/CurrentVersion/Explorer/Shell Folders';
var
Reg: TRegistry;
begin
Result := '';
Reg := TRegistry.Create;
try
Reg.RootKey := HKEY_CURRENT_USER;
if Reg.OpenKey(SCookieKey, False) then
Result := Reg.ReadString('Cookies');
finally
Reg.Free;
end;
end;
procedure TMainForm.LoadCookiesExecute(Sender: TObject);
var
Found: Integer;
SearchRec: TSearchRec;
Strings: TStrings;
begin
Strings := ListBox1.Items;
Strings.Clear;
Folder := CookieFolder;
Found := FindFirst(Folder + '/*.txt', faAnyFile, SearchRec);
while Found = 0 do begin
if (SearchRec.Attr and faDirectory) = 0 then
Strings.Add(SearchRec.Name);
Found := FindNext(SearchRec);
end;
FindClose(SearchRec);
end;
procedure TMainForm.FormShow(Sender: TObject);
begin
LoadCookies.Execute;
end;
procedure TMainForm.ListBox1Click(Sender: TObject);
var
FileName: string;
begin
if ListBox1.ItemIndex = -1 then exit;
FileName := Folder + '/' + ListBox1.Items[ListBox1.ItemIndex];
try
Memo1.Lines.LoadFromFile(FileName);
except
on E: Exception do begin
Memo1.Lines.Clear;
Memo1.Lines.Add(E.Message);
end;
end;
end;
procedure TMainForm.DeleteCookieUpdate(Sender: TObject);
begin
(Sender as TAction).Enabled := ListBox1.ItemIndex <> -1;
end;
procedure TMainForm.DeleteCookieExecute(Sender: TObject);
var
FileName: string;
begin
FileName := Folder + '/' + ListBox1.Items[ListBox1.ItemIndex];
DeleteFile(FileName);
ListBox1.Items.Delete(ListBox1.ItemIndex);
end;
procedure TMainForm.SearchCookieExecute(Sender: TObject);
var
ACookie: string;
i: Integer;
begin
if not InputQuery('Search Cookie', 'What cookie would you search for?',
ACookie) then Exit;
ACookie := UpperCase(ACookie);
for i := 0 to ListBox1.Items.Count - 1 do begin
if Pos(ACookie, UpperCase(ListBox1.Items)) > 0 then begin
ListBox1.ItemIndex := i;
ListBox1Click(Self);
Exit;
end;
end;
end;
end.
这是程序 ExplorerCookies.dpr
program ExplorerCookies;
uses
Forms,
MainFormUnit in 'MainFormUnit.pas' {MainForm};
{$R *.RES}
begin
Application.Initialize;
Application.Title := 'Explorer Cookies';
Application.CreateForm(TMainForm, MainForm);
Application.Run;
end.
全部存成文件,编译就行了
来源于超级猛料2003,像这种东西找超级猛料2003,里边差不多都有