Internet Explorer programming brief description (6) Custom browser context menu

xiaoxiao2021-03-06  48

Keywords: WebBrowser, Internet Explorer, Custom Context Menu, ShowcontextMenu, IDochostuiHandler

1. Overview Internet Explorer provides a very developed interface that allows developers not only embedding their browser cores, but also through various interfaces to achieve deeper control. This article will be introduced to one of the topics of the browser - Custom Context menu.

2. The simplest case-defined IE and webbrowser context menu, the simplest way is to add a custom key value to the registry's HKEY_CURRENT_USER / SOFTWARE / Microsoft / Internet Explorer / Menuext, steps below: 1) Add one The new key, its name is the menu item name in the context menu, such as HKEY_CURRENT_USER / SOFTWARE / Microsoft / Internet Explorer / Menuext / & Google Search2) Set the default value of the new button to a web page containing the script The URL (or full name), the script in this web page will be executed by the browser after the user clicks "Google Search" in the context menu.

3) In the new button, you can also create a new binary value contexts to specify whether our new menu item is for a specific web object, and its value can be a combination of the following value (logic or)

Context valueDefault 0x1Images 0x2controls 0x4tables 0x8text selection 0x10anchor 0x20

4) You can also create a DWORD type FLAGS item and set its value to 0x01, which will make the aforementioned script in a modal window, as if it is called through Window.ShowModalDialog, but the difference is in the script. You can access the Window object. 5) The instance script is as follows: