How To Controlling the Currently Running Instance of IE3 via DDE (160976)



The information in this article applies to:

  • Microsoft Internet Explorer (Programming) 3.0
  • Microsoft Internet Explorer (Programming) 3.01
  • Microsoft Internet Explorer (Programming) 3.02

This article was previously published under Q160976

SUMMARY

In some instances you may want to control Internet Explorer from another application, typically to navigate to a specific URL. One way you can do this is through the InternetExplorer OLE Automation object that Internet Explorer exposes. However, this method always launches a new instance of Internet Explorer, which may not necessarily be the desired behavior.

OLE Automation allows an application to connect to an instance of some object type that is already running through the Running Object Table (ROT). However, InternetExplorer, version 3.01 and earlier, does not register itself in the ROT, and therefore, cannot be controlled in this manner. The only way to currently do this with Internet Explorer is through DDE.

MORE INFORMATION

Using the Win32 SDK's DDEML\CLIENT sample, one can easily verify that DDE with Internet Explorer is fairly straightforward, as long as the correct information is specified. To tell Internet Explorer to navigate to a specific URL, for instance, you specify the following information in your DDE transaction:

   Application Name = iexplore
   Topic Name       = WWW_OpenURL
   Item Name        = http://www.microsoft.com
   Transaction Type = EXECUTE or REQUEST (either one works!)
				
Similarly, to get the current URL of a running instance of Internet Explorer, for example, you specify the following information:

   Application Name = iexplore
   Topic Name       = WWW_GetWindowInfo
   Item Name        = DoGetWindowInfo
   Transaction Type = REQUEST
				
Note that IE 2.0 and earlier used "mosaic" as its application name, instead of "iexplore" as specified above.

For more information about DDE support in Internet Explorer, please see the following article in the Microsoft Knowledge Base:

160957 Dynamic Data Exchange Support in Microsoft Internet Explorer

If launching a new Internet Explorer window is desired, one workaround would be to use the InternetExplorer automation object, as mentioned in the SUMMARY section above. For example, you can launch Internet Explorer using Visual Basic and have it open the Microsoft Web page at http://www.microsoft.com by doing the following:
      Dim Explorer As Object

      Explorer = CreateObject ("InternetExplorer.Application")
      Explorer.Navigate "http://www.microsoft.com"
      Explorer.Visible = True
				

For Internet Explorer 3.x, more information on the InternetExplorer automation object can be found under the "Web Browsing Obj" section on the ActiveX SDK page at http://www.microsoft.com/intdev/sdk, or by searching on "InternetExplorer" off of the ActiveX SDK online documentation.

For Internet Explorer 4.0, refer to the "Reusing the WebBrowser Control" section under the "Internet Tools and Technologies" book of the Internet Client SDK documentation, or by searching on "InternetExplorer" off of the Internet Client SDK docs index.

Modification Type:MinorLast Reviewed:3/3/2005
Keywords:kbhowto KB160976