Click here to Skip to main content
15,891,649 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
After registering BHO on machine with Win7 i realized that something is wrong. When IE is not opened as administrator then OnBeforeNavigate2 and OnDocumentComplete events of WebBrowser are not fired. When I run IE as administrator these methods are fired correctly. I subscribing to these metods the following way:

C#
public int SetSite(object site)
{
    if (site != null)
    {
        webBrowser = (WebBrowser)site;
        webBrowser.DocumentComplete += new DWebBrowserEvents2_DocumentCompleteEventHandler(this.OnDocumentComplete);
        webBrowser.BeforeNavigate2 += new DWebBrowserEvents2_BeforeNavigate2EventHandler(this.OnBeforeNavigate2);

    }
    else
    {
        webBrowser.DocumentComplete -= new DWebBrowserEvents2_DocumentCompleteEventHandler(this.OnDocumentComplete);
        webBrowser.BeforeNavigate2 -= new DWebBrowserEvents2_BeforeNavigate2EventHandler(this.OnBeforeNavigate2);
    }
    return 0;
}


UAC function is turned on with default value. On machine with Windows XP everything was OK(even on limited account).
Posted
Comments
Sergey Alexandrovich Kryukov 2-Jan-12 12:46pm    
Not clear. What "IE"? you are running WebBrowser insider your process, which is not the same. What does it mean: IE is "opened" or not? For a user it may apply, but as a developer you should understand that the application is not "opened" or "closed", but first of all -- why IE? It should be your application.

What does it mean "subscribed to these methods"? You have events and handlers.

Did you run SetSite under debugger? Did you try to run any of the handlers under debugger, set breakpoints at the start of each handler?
--SA

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900