⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unit1.~pas

📁 Delphi实效编程百例的随书源代码 这是其中的程序发布部分
💻 ~PAS
字号:
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.

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -