unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Buttons, ExtDlgs, Registry;
type
TForm1 = class(TForm)
Label1: TLabel;
BtnCaption: TEdit;
Icon: TEdit;
Label2: TLabel;
HotIcon: TEdit;
Label3: TLabel;
Exec: TEdit;
Label4: TLabel;
SpeedButton2: TSpeedButton;
SpeedButton3: TSpeedButton;
SpeedButton1: TSpeedButton;
Button1: TButton;
OpenPictureDialog1: TOpenPictureDialog;
OpenDialog1: TOpenDialog;
procedure SpeedButton1Click(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject);
procedure SpeedButton3Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.SpeedButton1Click(Sender: TObject);
begin
if OpenPictureDialog1.Execute then
Icon.Text := OpenPictureDialog1.FileName;
end;
procedure TForm1.SpeedButton2Click(Sender: TObject);
begin
if OpenPictureDialog1.Execute then
HotIcon.Text := OpenPictureDialog1.FileName;
end;
procedure TForm1.SpeedButton3Click(Sender: TObject);
begin
if OpenDialog1.Execute then
Exec.Text := OpenDialog1.FileName;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
registerTemp : TRegistry;
myGuID : string;
begin
registerTemp := TRegistry.Create;
myGuID := '{D5C1CCC2-811B-4bf2-BF21-0D3B89600F5B}';
with registerTemp do
begin
RootKey := HKEY_LOCAL_MACHINE;
if OpenKey('Software/Microsoft/Internet Explorer/Extensions/'+myGuID,true) then
begin
WriteString('ButtonText',BtnCaption.Text);
WriteString('CLSID','{1FBA04EE-3024-11D2-8F1F-0000F87ABD16}');
WriteString('Default Visible','Yes');
WriteString('Icon',Icon.Text);
WriteString('HotIcon',HotIcon.Text);
WriteString('Exec',Exec.Text);
ShowMessage('操作成功');
end
else
ShowMessage('操作失败');
CloseKey;
end;
end;
end.