ActiveX navigation to a new web page RRS feed

  • Question

  • An ActiveX control can launch a new Internet Explorer web page pretty easily, HlinkSimpleNavigateToString works fine for this and ShellExecute will also work.

    However, I can't figure out how to make Internet Explorer just navigate to a different web page without opening a new instance.

    So the ActiveX control is on page A, and I just want to navigate to page B, closing the control, etc.

    We used to be able to use HlinkSimpleNavigateToString with the "_top" option, but this has stopped working and now return E_ACCESSDENIED.

    Does anyone know the right way to do this these days?


    Tuesday, June 28, 2011 4:28 PM


All replies

  • You really don't want to use ShellExecute() or any of the HlinkSimpleNavigate*() family of functions.  Doing so incorrectly can open up a host of security problems if your control is scriptable.

    The correct thing to do is implement IObjectWithSite(), then use your site pointer to get the IWebBrowser2 for the tab.  Then you can use IWebBrowser2::Navigate2() to do whatever you need.

    Tuesday, June 28, 2011 10:11 PM
  • Thanks, I have been looking at thise classes.

    Does anyone have a good example of this? I don't want to embed a web browser, I want to tell Internet Explorer to navigate somewhere.

    Thanks in advance....

    Thursday, June 30, 2011 7:43 PM
  • Hi bill,

    Based on Jeff's suggestion, you may write your activeX control as a BHO which is a IObjectWithSite object and use all functions from IWebBrowser object. Here is the sample for how to write a BHO: http://msdn.microsoft.com/en-us/library/bb250489(VS.85).aspx


    Yi Feng Li [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    • Marked as answer by billappleton Friday, July 8, 2011 1:28 PM
    Monday, July 4, 2011 5:02 AM