The information in this article applies to:
SUMMARYIt is possible to connect to a running instance of Internet Explorer version 4.0 or later using the SHDocVw.ShellWindows collection. MORE INFORMATION
Normally, an application connects to a running instance of another
application using the Running Object table. Because Internet Explorer 4.0
does not register itself in the running object table, another method is
necessary.
In C++, a connection can be accomplished in roughly the same way. Visual C++ Native Com Support is used here for the sake of brevity. Add references to Shdocvw.dll and Mshtml.dll to the project:
Declare an instance of an IShellWindows pointer in your view class:
Create an instance of a ShellWindows object in your view's constructor:
Use the ShellWindows object in your view's OnInitialUpdate function:
The previous method for connecting to a running instance of the Internet Explorer does not work if Shell Integration is not installed or if "Browse in a new process" is selected in Internet Explorer 4.0. If these factors cannot be controlled, there is still one possible method that may work. A browser helper object can be written to register Internet Explorer 4.0 in the running object table (ROT). There are many implementations possible here depending on how the application is to determine the instance of Internet Explorer with which to connect. This is just one possible solution: The browser helper object, having access to the object model of the instance of Explorer that launched it, would determine if this is the instance of the browser that should be registered in the running object table. The interface that the consumer is interested in can be registered in the ROT with the RegisterActiveObject function and a dummy CLSID that the consumer will recognize. Another solution, that would allow multiple instances of the explorer to be registered in the ROT, would be to have the Browser Helper object compose an Item moniker based on a GUID and piece of data unique to each instance of Internet Explorer. The moniker would be registered in the ROT with the IRunningObjectTable::Register method. Again, the consumer would have to know how recognize this moniker. REFERENCESFor more information, please visit the MSDN Online Web Workshop at: http://msdn.microsoft.com/workshop/The Internet Client SDK; search on Internet Tools and Technologies - Windows Shell API For additional information, please see the following article in the Microsoft Knowledge Base: Q179230 FILE: IEHelper-Attaching to IE4 using a Browser Helper Object (c) Microsoft Corporation 1997, All Rights Reserved. Contributions by Robert Duke, Microsoft Corporation Additional query words: helper connect
Keywords : kbcode kbIE400 kbIE500 InetSDKShellObjMod |
Last Reviewed: November 10, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |