Unit1.pas
上传用户:newxcj
上传日期:2020-02-13
资源大小:12k
文件大小:2k
- unit Unit1;
- interface
- uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs,registry, StdCtrls, XPMan;
- type
- TForm1 = class(TForm)
- Button1: TButton;
- Open: TOpenDialog;
- Edit1: TEdit;
- Edit2: TEdit;
- Edit3: TEdit;
- Edit4: TEdit;
- Button2: TButton;
- Label1: TLabel;
- Label2: TLabel;
- Label3: TLabel;
- Label4: TLabel;
- XPManifest1: TXPManifest;
- procedure Button1Click(Sender: TObject);
- procedure Button2Click(Sender: TObject);
- procedure FormCreate(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- Form1: TForm1;
- implementation
- {$R *.dfm}
- procedure Addbtn2IE(programpath,btntext,hicon,icon:string);
- const
- tagit='{10954c80-4F0F-11d3-B17C-00C0DFE39736}';
- var
- reg:tregistry;
- path1:string;
- merg:string;
- begin
- reg:=tregistry.Create;
- try
- with reg do
- begin
- rootkey:=HKEY_LOCAL_MACHINE;
- path1:='SoftwareMicrosoftInternet ExplorerExtensions';
- merg:=path1+tagit;
- openkey(merg,true);
- writestring('buttontext',btntext);
- writestring('MenuText','Tools Menu Item');
- writestring('MenuStatusBar','Run Script');
- writestring('Clsid','{1FBA04EE-3024-11d2-8F1F-0000F87ABD16}');
- writestring('Default Visible','Yes');
- writestring('Exec',programpath);
- writestring('HotIcon',icon);
- writestring('Icon',hicon);
- end
- finally
- reg.CloseKey;
- reg.Free;
- end;
- end;
- procedure TForm1.Button1Click(Sender: TObject);
- begin
- if open.Execute then edit1.Text:=open.FileName;
- end;
- procedure TForm1.Button2Click(Sender: TObject);
- begin
- if edit1.Text<>'' then addbtn2IE(edit1.Text,edit2.Text,edit3.Text,edit4.Text)
- else
- showmessage('You must chose a file');
- end;
- procedure TForm1.FormCreate(Sender: TObject);
- begin
- edit1.Clear;
- edit2.Clear;
- edit3.Clear;
- edit4.Clear;
- end;
- end.