Article ID: 202009 - Last Review: May 11, 2006 - Revision: 2.0 BUG: Error Accessing Window.external in ATL DHTML ControlThis article was previously published under Q202009 On This PageSYMPTOMS
A DHTML control created with the ATL Object Wizard fails with the following script error when accessing window.external from Internet Explorer 5.0:
'Object doesn't support this property or method'
CAUSE
A DHTML control contains two IDispatch interfaces, a default interface for scripting and another for the window.external methods. The WebBrowser control incorrectly uses the default IDispatch interface when invoking window.external methods.
RESOLUTION
Implement the window.external IDispatch method in a separate COM object. Use the following steps to implement a sub-object for a default ATL DHTML control project:
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article. MORE INFORMATION
Microsoft Active Template Library (ATL), Version 3.0, allows developers to write Dynamic HTML (DHTML) controls. A DHTML control is an ActiveX control which hosts the Internet Explorer WebBrowser control to display an HTML file. The HTML file is stored in the control as a resource and can contain DHTML and script to create an interactive user interface.
One additional feature of the DHTML control is that it's methods can be invoked from the HTML page by means of the DHTML window.external object. When any method is invoked from script using window.external, the WebBrowser control obtains the IDispatch for these methods by calling the host implementation of IDocHostUIHandler::GetExternal(). The correct IDispatch interface is set by a call to CAxWindow::SetExternalDispatch() in the control's OnCreate message handler. The problem occurs because the WebBrowser control uses the IDispatch interface to query for IDispatchEx. If this fails, the host is queried for the default IDispatch instead of using the original interface. Steps to Reproduce Behavior
REFERENCESFor more information about developing Web-based solutions for Microsoft Internet Explorer, visit the following Microsoft Web sites: http://msdn.microsoft.com/ie/
(http://msdn.microsoft.com/ie/)
http://support.microsoft.com/iep (http://support.microsoft.com/iep) For more information about ATL DHTML controls, please refer to the Microsoft Visual C++ 6.0 online documentation. For additional information, please refer to the following article in the Microsoft Knowledge Base: 188015
(http://support.microsoft.com/kb/188015/EN-US/
)
TITLE: HOWTO: Access Methods/Properties of Container from Script
(c) Microsoft Corporation 1999, All Rights Reserved. Contributions by Mark Davis, Microsoft Corporation. | Article Translations
|

Back to the top
