Extending the IE Context Menu in your App using the Registry

.

The sample code given is compiled using Visual c++ 5.0, Windows 95

Internet Explorer 4.0 uses OLE Activex control and Active Document interfaces to connect components.I will just briefly talk about the Internet Explorer's architecture. Mainly Internet Explorer is just a small application which uses the internet explorer 4.0 components for favourites maintenance,history maintaenance and so on. This executable directly hosts the SHDOCVW.DLL which is nothing but the web browser control. SHDOCVW.DLL in turn hosts the MSHTML.DLL. Implementing the webbrowser control is little bit difficult than implementing the MSHTML.DLL.

MSHTML.DLL performs the HTML parsing and rendering in Internet Explorer 4.0 and also exposes the HTML document through the Dynamic HTML Object Model. This DLL hosts the scripting engines, Java VM, ActiveX Controls, Plug_Ins, and the other components that may be referenced in the HTML Document that is loaded. This DLL implements the Active Document Server interfaces which allows users to host this DLL using standard COM interfaces.

But if we host MSHTML.DLL then we should implement some of the features which are already in the webbrowser control. I stop with this and go on to explain our topic of this article. If any body wants to study more about the internet explorer 4.0 architecture and how to explore it then install INETSDK which is available for download in the http://www.microsoft.com or install it from the MSDN CD Pack.

If we write an application using WebBrowser Control. To learn how to use WebBrowser Control refer to the article by Daniel Harth http://www.codeguru.com/internet/webbrowser_control.shtml Then if we right click on the window the webbrowser control will display the default internet explorer's context menu. But if we want to modify it then what should we do? The answer is simple just go to the windows registry and add a new menu item. Going Crazy!! Just wait a moment I will explain. We can also control the context menu programmaticallly which at present I am exploring. I will update that later.

Menu Items can be added to the existing context menus of the WebBrowser by placing entries in the registry and linking these to URLs that execute what you want. To add additional items to the standard WebBrowser context menus, open the following key. Dont panic if you don't have one just create it right there.


 HKEY_CURRENT_USER
    Software
        Microsoft
            Internet Explorer
                MenuExt

 

Under this key create another key which contains the text to be displayed in the menu.

The default value of this key will contain the URL which will be executed when the user selects this menu item.

The key name can include the '&' character, which will cause the character immediately following the '&' to be underlined. The URL will be loaded inside of a hidden HTML dialog box, all of the script will be executed, and the dialog will be closed. The hidden HTML dialog's external.menuArguments property contains the window object of the window on which the context menu item was executed.

The following registry entry will add an item with the title "Home" to the WebBrowser context menu and will execute the URL "http://www.microsoft.com"

HKEY_CURRENT_USER
    Software
        Microsoft
            Internet Explorer
                MenuExt
                    Home = "http://www.microsoft.com"

 

The sample application hosts the WebBrowser control. Just add these entries in your windows registry and then run the sample application.In the application window right click and see the context menu "home" menu will be displayed.

If you find any bugs in this article or any comments feel free to mail me.

Download Sample (27 kb)

Article added on June 21 1998



Comments

  • API

    Posted by Legacy on 07/07/2003 12:00am

    Originally posted by: Mobeen

    But I want to Disable the IE toolbar and some options from menue bar , Is there any API thru which I do this thanx

    Reply
  • How to host a web browser control from an MFC Application

    Posted by Legacy on 11/29/2002 12:00am

    Originally posted by: chandrika

    good
    

    Reply
  • How to test ActiveX Control creating VC++ using ATL in internet

    Posted by Legacy on 11/12/2002 12:00am

    Originally posted by: swaminathan

    How to test ActiveX  Control creating VC++ using ATL in internet
    

    Reply
  • Hightlight text, right click on it and have that text searched at a particular search engine.

    Posted by Legacy on 04/10/2002 12:00am

    Originally posted by: Corey Laliberte

    Hello,

    I have an idea that could save lots of time. I want to be able to highlight a piece of text and have that text searched at a particular search engine. Most of the time it is appended to the search engine URL at the end. I was wondering if there was a way to do this? What would I need to do in order for this to occur?

    Thanks,
    Corey Laliberte

    Reply
  • How can i use beforenavigate2...?

    Posted by Legacy on 03/07/2002 12:00am

    Originally posted by: Vishal

    hi 
    
    i'm trying to use beforenavigate2 event of shdocvw.dll in vc++ , but i could not create a proper smart pointer as
    it shows functions in class but it gives compile time error
    that function not found , plz let me know how to solve this problem
    thanks and regards,
    Vishal

    Reply
  • Adding Sub-menus to the IE context menu

    Posted by Legacy on 02/12/2002 12:00am

    Originally posted by: Stuart Menzies

    I can add extra menu items onto my IE context menu.  
    
    Does anyone know how to add second/third/fourth level menu options onto these.

    i.e. I have created menu items at the following level:
    HKEY_CURRENT_USER
    Software
    Microsoft
    Internet Explorer
    MenuExt
    Home = "www.mysite.com"

    but, can I add sub menus off of the 'home' level ???

    Thanks in advance

    Regards
    Stuart Menzies


    PS a previous question asked how to call an exe :

    Just call it within a html page with some VBscript or Javascript, like :

    <SCRIPT LANGUAGE="VBscript" defer>
    Set WshShell = CreateObject("WScript.Shell")
    WshShell.Run "C:\\Folder\\Program.exe ", 1,0
    </SCRIPT>


    Reply
  • How can I embed a browser into my c++ app WITHOUT mfc ???

    Posted by Legacy on 01/26/2002 12:00am

    Originally posted by: Lutz Rosema

    Hi,

    I'm trying to embed a browser without MFC, but MS has no sample sourcecodes :(

    Reply
  • Screen scraping

    Posted by Legacy on 01/10/2002 12:00am

    Originally posted by: Frank

    I want to pull down a page and parse the contents to pass selected data to a speech engine. FOr instance, I want the system to read me the weather forecast. Suggestions on how to accomplish this or sample code showing capture of the page would be great. Thanks.

    Reply
  • How about running an application instead of an URL?

    Posted by Legacy on 10/19/2001 12:00am

    Originally posted by: Dacy

    Is there a way to write as a default value for Home key something like: Home = "c:\myapp.exe"? I've tried but nothing happened...

    Thank a lot,
    Dacy

    Reply
  • i can't find subdirectory res and its files, i am crying...

    Posted by Legacy on 04/03/2001 12:00am

    Originally posted by: Ida Zhang

    i can't find subdirectory res and its files, i am crying...

    Reply
  • Loading, Please Wait ...

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • Live Event Date: December 11, 2014 @ 1:00 p.m. ET / 10:00 a.m. PT Market pressures to move more quickly and develop innovative applications are forcing organizations to rethink how they develop and release applications. The combination of public clouds and physical back-end infrastructures are a means to get applications out faster. However, these hybrid solutions complicate DevOps adoption, with application delivery pipelines that span across complex hybrid cloud and non-cloud environments. Check out this …

  • On-demand Event Event Date: October 29, 2014 It's well understood how critical version control is for code. However, its importance to DevOps isn't always recognized. The 2014 DevOps Survey of Practice shows that one of the key predictors of DevOps success is putting all production environment artifacts into version control. In this webcast, Gene Kim discusses these survey findings and shares woeful tales of artifact management gone wrong! Gene also shares examples of how high-performing DevOps …

Most Popular Programming Stories

More for Developers

RSS Feeds