Adding Toolbar Buttons
This tutorial explains how to add a toolbar button to the Windows Internet Explorer user interface. The toolbar button can either run a Microsoft Win32 application, run a script, or open an Explorer Bar. If you also want to create a menu item for the Win32 application or script, see the Adding Menu Items tutorial.
Requirements and Dependencies
Developers who want to add toolbar buttons to Internet Explorer must be familiar with the registry and globally unique identifiers (GUID).
This feature is only available in Microsoft Internet Explorer 5 and later. Internet Explorer 4.0 allows you to add a custom Explorer Bar, but there is no method for adding a toolbar button to access your Explorer Bar.
Toolbar buttons require two sets of icons: one set with the active (color) icons and one set with the default (grayscale) icons. These icons can be stored in two .ico files or inside a resource (like a .dll or .exe file). Icons and strings stored inside a resource can be referenced by providing the path to the resource and reference identification in the format, "path, resource_id". For example, if you wanted to use string resource 123 in Example.dll, you would use "Example.dll, 123". For more information about what icons are required and for tips on designing icons for Internet Explorer, see Toolbar Button Style Guide.
General Steps
The steps in this section must be followed when adding any toolbar buttons to the Internet Explorer user interface. If any information is omitted, the toolbar button will not be displayed.
- Create a valid GUID.
You can use Guidgen.exe from Microsoft Visual Studio, or Uuidgen.exe from the Windows Software Development Kit (SDK).
- Create a new key (using the GUID as the name) in the registry under:
HKEY_LOCAL_MACHINE
Software
Microsoft
Internet Explorer
Extensions
{GUID}{GUID} is the valid GUID that you created in step 1.
- Required. Create the following string values in the registry under the new key:
- ButtonText - Set the value to the label you want for the toolbar button.
- HotIcon - Set the full path of the .ico file that contains the three color icons.
- Icon - Set the full path of the .ico file that contains the three grayscale icons.
- Optional. The following values determine if the icon is initially visible.
- Default Visible - To make the toolbar button to appear on the Internet Explorer toolbar by default, set Default Visible to "Yes", otherwise set Default Visible to "No".
Note If the user has customized the toolbar, the button will not appear on the toolbar automatically. The toolbar button will be added to the choices in the Customize Toolbar dialog box and will appear if the toolbar is reset.
- Default Visible - To make the toolbar button to appear on the Internet Explorer toolbar by default, set Default Visible to "Yes", otherwise set Default Visible to "No".
- Optional. To provide support for multiple native languages (like French or Japanese), complete the following steps to support different native languages:
- Determine the LCID of the native language you want to support. See Language Identifier Constants and Strings for a complete list.
- Create a new key, Lang####, using the LCID from the previous step in place of "####" in the registry as follows:
For example, the key name should be Lang0411 for a Japanese implementation, since the LCID for Japanese is 0411.
Adding the Details
To complete the setup of the custom command, you must provide details of the action that takes place when the button is clicked. The values that you need depend on what the toolbar button is going to run. The following list contains links to the sections with the steps required to complete the addition of a toolbar button.
COM Objects
In order to invoke a Component Object Model (COM) object from Internet Explorer, it must implement IOleCommandTarget. Only one command is supported per object; the COM object's IOleCommandTarget::Exec is always called with nCmdID=0 and with VARIANT arguments set to NULL. Additionally, the implementation of IOleCommandTarget::QueryStatus is always called with cCmds=1.
If the COM object needs to access the browser or Dynamic HTML (DHTML) Object Model of the active page, it must implement IObjectWithSite. Internet Explorer calls IObjectWithSite::SetSite with a pointer to IShellBrowser.
The following steps are required to complete the creation of a toolbar button that implements a COM object.
- Register the COM object.
- Create a new string value, CLSID, in the registry as follows:
Set the value of CLSID equal to
{1FBA04EE-3024-11d2-8F1F-0000F87ABD16}
to specify the CLSID_Shell_ToolbarExtExec extension class. - Create a new string value, ClsidExtension, in the registry as follows:
Set the value of ClsidExtension equal to the GUID of the COM object.
Explorer Bars
The following steps are required to complete the creation of a toolbar button that opens an Explorer Bar.
- Create a new string value, CLSID, in the registry as follows:
Set the value of CLSID equal to
{E0DD6CAB-2D10-11D2-8F1A-0000F87ABD16}
to specify the CLSID_Shell_ToolbarExtBand extension class. - Create a new string value, BandCLSID, in the registry as follows:
Set the value of BandCLSID to the CLSID of the Explorer Bar to open.
Scripts
The following steps are required to complete the creation of a toolbar button that runs a script.
- Create a new string value, CLSID, in the registry as follows:
Set the value of CLSID equal to
{1FBA04EE-3024-11D2-8F1F-0000F87ABD16}
to specify the CLSID_Shell_ToolbarExtExec extension class. - Create a new string value, Script, in the registry as follows:
Set the value of Script to the full path of the script to run.
To add a menu item in the Tools menu with the same functionality, see the Adding Menu Items tutorial.
Executable Files
The following steps are required to complete the creation of a toolbar button that runs an executable file.
- Create a new string value, CLSID, in the registry as follows:
Set the value of CLSID equal to
{1FBA04EE-3024-11D2-8F1F-0000F87ABD16}
to specify the CLSID_Shell_ToolbarExtExec extension class. - Create a new string value, Exec, in the registry as follows:
Set the value of Exec to the full path of the .exe file to run.
To add an item to the Tools menu with the same functionality, see the Adding Menu Items tutorial.
Related Topics
http://cgeers.wordpress.com/2008/02/16/internet-explorer-toolbar/
http://www.codeproject.com/KB/shell/dotnetbandobjects.aspx
Hope it helps
How To Adding Toolbar Buttons Internet Explorer using C#.Net()...
PLZ Help Me Friends... ... .( In Slides Way)... ... .
출처: http://msdn.microsoft.com/en-us/library/aa753588(v=VS.85).aspx
'IT-개발,DB' 카테고리의 다른 글
[VC++] Installing a Search Provider and Setting the Default (0) | 2010.09.28 |
---|---|
[VC++] Toolbar Button Style Guide (0) | 2010.09.28 |
[VC++] Adding Explorer Bars (0) | 2010.09.28 |
[C#] Ron Wilson 의 윈도우즈 서비스 라이브러리 (0) | 2010.09.28 |
[C#.NET] Windows 서비스 응용 프로그램 만들기 참고 (0) | 2010.09.28 |
댓글