This tutorial explains how to add an entry into the standard context menus in Microsoft® Internet Explorer that executes a script specified by a URL.
Developers who want to add entries to the standard context menus in Internet Explorer must be familiar with the registry. Developers should also be familiar with context menus. For more information about context menus, see the Windows Shell API documentation in the Platform Software Development Kit (SDK).
The implementation described here is valid for Internet Explorer version 4.0 or later. This feature is not available in earlier versions of Internet Explorer.
The following steps are required to add an entry into the standard context menus in Internet Explorer.
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt
The result should look like:
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\<Menu Text>
<Menu Text> should be replaced with the text that you want displayed in the context menu. The name can include an ampersand (&) character, which will cause the character that follows to be underlined and used as a shortcut key.
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\<Menu Text>
The result should look like:
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\<Menu Text>\Contexts
Set the value of Contexts to indicate which contexts your entry should appear in the standard context menu by using a bit mask consisting of the logical OR of the following values:
Context | Value |
---|---|
Default | 0x1 |
Images | 0x2 |
Controls | 0x4 |
Tables | 0x8 |
Text selection | 0x10 |
Anchor | 0x20 |
For example, if you want your context menu entry to appear in the default context menu and when the context is a text selection, set the value of Contexts to 0x11.
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\<Menu Text>
The result should look like:
HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\<Menu Text>\Flags
Set the value of Flags to 0x1 to make the script run just as if it had been called through the showModalDialog method. Unlike the showModalDialog method, the script can access the window object of the parent window from the menuArguments property of the external object.
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".
The following list contains links to the overviews related to context menu entries.