Delphi Programming

  1. Home
  2. Computing & Technology
  3. Delphi Programming

How to add a button to the IE Toolbar

By Zarko Gajic, About.com

Here's how to add a button to Interner Explorer toolbar:

1. ButtonText = Text at the bottom of the button
2. MenuText = The tools menu item with a reference to your program.
3. MenuStatusbar = *Ignore*
4. CLSID = Your unique classID. You can use GUIDTOSTRING to create a new CLSID (for each button).
5. Default Visible := Display it.
6. Exec := Your program path to execute.
7. Hoticon := (Mouse Over Event) ImageIndex in shell32.dll
8. Icon := ImageIndex in shell32.dll

After you run the code below, start a new instance of IE. You might need to go to View | Toolbars | Customize and move your button from "Available toolbar buttons" to "Current toolbar buttons"

~~~~~~~~~~~~~~~~~~~~~~~~~
procedure CreateExplorerButton;
const
   // the same explanation as for the CLSID
   TagID = '\{10954C80-4F0F-11d3-B17C-00C0DFE39736}\';
var
   Reg: TRegistry;
ProgramPath: string;
   RegKeyPath: string;
begin
  ProgramPath := 'c:\folder\exename.exe';
  Reg := TRegistry.Create;
  try
   with Reg do begin
    RootKey := HKEY_LOCAL_MACHINE;
    RegKeyPath := 'Software\Microsoft\Internet Explorer\Extensions';
    OpenKey(RegKeyPath + TagID, True) ;
    WriteString('ButtonText', 'Your program Button text') ;
    WriteString('MenuText', 'Your program Menu text') ;
    WriteString('MenuStatusBar', 'Run Script') ;
    WriteString('ClSid', '{1FBA04EE-3024-11d2-8F1F-0000F87ABD16}') ;
    WriteString('Default Visible', 'Yes') ;
    WriteString('Exec', ProgramPath) ;
    WriteString('HotIcon', ',4') ;
    WriteString('Icon', ',4') ;
   end
  finally
   Reg.CloseKey;
   Reg.Free;
  end;
end;
~~~~~~~~~~~~~~~~~~~~~~~~~

Delphi tips navigator:
» Disabling an event handler after its first exexcution
« How to make a TDateTimePicker display blank

Zarko Gajic
Guide since 1998

Zarko Gajic
Delphi Programming Guide

Explore Delphi Programming

About.com Special Features

Delphi Programming

  1. Home
  2. Computing & Technology
  3. Delphi Programming
  4. Coding Delphi Applications
  5. Delphi Tips and Tricks
  6. 2002 Delphi Tips
  7. How to add a button to the IE Toolbar?

©2009 About.com, a part of The New York Times Company.

All rights reserved.