The information in this article applies to:
SYMPTOMSAn ActiveX control's WM_CREATE handler is not called in Internet Explorer 4.01 until the control is scrolled into view (in MFC, OnCreate() is the WM_CREATE handler). The same problem occurs if the control has a size of 0,0. If you are creating child windows in your WM_CREATE handler, they won't exist. If you have an automation method that is called from script (in Window_Onload for example) that manipulates the control's HWND or its child windows, you will get an ASSERT in debug mode on a line in MFC that reads the following:
or in ATL:
CAUSEInternet Explorer 4.01 does not in-place activate controls until they are visible. This is an optimization to reduce memory consumption and speed up load times for Web pages with ActiveX controls. Most ActiveX control frameworks like MFC and ATL create their control window during in-place activation. So unless a control is visible, it won't be in-place activated. If it's not in-place activate, it won't be created. If it's not created, the WM_CREATE handler is not called. RESOLUTIONYou can workaround this by creating the control window in IOleObject::SetClientSite(), which is always called regardless if the control is in-place activated. MFCMFC provides a function called COleControl::CreateControlWindow() to create the control's window. MFC's implementation of IOleObject::SetClientSite() calls COleControl::OnSetClientSite(). Add the following to your COleControl-derived class:
ATLATL also provides a function called CComControl::CreateControlWindow(). But it won't re-parent the window later so the control needs to manually do this during in-place activation (CComControlBase::InPlaceActivate). Add the following to the declaration of your CComControl-derived class (typically in the class header file):
STATUSThis behavior is by design. MORE INFORMATION
An ActiveX control can be redesigned to not require a window at all times.
Initialization code can be moved out of OnCreate to
COleControl::OnSetClientSite (MFC) or CComControl::SetClientSite (ATL).
Automation methods can be rewritten either to not use a window for storage
and functionality, to fail silently until the control is visible, or to
queue up requests for processing when the window is available.
REFERENCESFor more information, please see the MSDN Web Workshop: http://msdn.microsoft.com/workshop/default.asp(c) Microsoft Corporation 1998, All Rights Reserved. Contributions by Samson Tanrena, Microsoft Corporation. Additional query words:
Keywords : kbActiveX kbCtrl kbIE400 kbIE401 kbInternet kbDSupport kbIEFAQ |
Last Reviewed: January 27, 2000 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |