How to attach a BHO in currently running IE instance

nishant sagar posted at 05-Jul-08 12:57
Hi Friends,

How can I attach a Browser Helper Object to a currently running instance of Internet Explorer? Meaning, I don't want to create a new instance of IE after installing my BHO, but rather want it working with the currently running instance.

The scenario is that we have this webpage where we show two buttons, one for "Download Application" and one for "Continue". Initially, the download button will be enabled and the continue button will be shown as disabled.

On download button click user will download and install our application and along with that our BHO. This BHO will check if our application is already installed in the user's machine or not. If it is already installed, we will enable the Continue button and disable the Download button, else, its opposite will be true.

Now it works perfectly if I open a new instance of IE after installing the application. But I need it to take effect from the same old currently running instance of IE from where the user downloaded the application.

After searching a while on internet I am able to get hold of the currently running instance of IE using the following code....

ShellWindows shellWindows = new ShellWindows();
            InternetExplorerClass internetExplorer = new InternetExplorerClass();

            foreach (object objWindow in shellWindows)
            {
                if (objWindow.GetType().ToString() == "SHDocVw.InternetExplorerClass")
                {
                    //it shows me the type of current instance as of InternetExplorerClass
                    //meaning that of all running windows, IE windows are detected
                    MessageBox.Show(objWindow.GetType().ToString());

                    //internetExplorer = (InternetExplorerClass)objWindow;
                    //webBrowser = (SHDocVw.WebBrowser)internetExplorer;
                }
            }


... and now am searching about how to move further. Any ideas????

Thanks and regards,
Nishant


Click here to sign in and reply. You could earn money via our $500 contest just for being helpful.
  How to attach a BHO in currently running IE instance - nishant sagar  05-Jul-08 12:57 12:57:00 AM
      Attach BHO to running instance of IE - Sanjay Verma  05-Jul-08 01:24 1:24:40 AM
      See this for BHO - Sujit Patil  05-Jul-08 01:44 1:44:31 AM
      Try like this - santhosh kumar  05-Jul-08 01:54 1:54:37 AM
          Need to attach BHO to RUNNING IE Instance, not new instances... - nishant sagar  05-Jul-08 05:09 5:09:41 AM
View Posts