Add own item to Internet Explorer Tools menu

If you want to add own items to Tools menu of Internet Explorer, it’s simple. All we have to do is to add some keys to Windows registry, therefore we must use Registry unit.
As you can see in source code, we must specify the menu item label (or button label) and of course the path of file we want to run. As example, we will run Calc.exe.

unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Registry;

type
  TForm1 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure IEButton(Path: string);
const
  Tagit = '{10954C80-4F0F-11d3-B17C-00C0DFE39736}';
var
  Reg: TRegistry;
  Key: string;
begin
  Reg := TRegistry.Create;
  try
    with Reg do
    begin
      RootKey := HKEY_LOCAL_MACHINE;
      Key := 'SoftwareMicrosoftInternet ExplorerExtensions' + Tagit;
      OpenKey(Key, True);
      WriteString('ButtonText', 'Toolbar button label');
      WriteString('MenuText', 'Menu item label');
      WriteString('MenuStatusBar', 'Run Script');
      WriteString('ClSid', '{1FBA04EE-3024-11d2-8F1F-0000F87ABD16}');
      WriteString('Default Visible', 'Yes');
      WriteString('Exec', Path);
      WriteString('HotIcon', ',4');
      WriteString('Icon', ',4');
    end
  finally
    Reg.CloseKey;
    Reg.Free;
  end;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  IEButton('c:windowssystem32calc.exe');
end;

end.