PRB: MFC ActiveX Control Subclassing Comctl32 Windows Throws 0x80004005 from a VB .exeID: Q223152
|
An MFC ActiveX control that subclasses any of the window classes implemented by Comctl32.dll causes the following error to be thrown from a Visual Basic .exe.
The debug version of the ActiveX control causes an ASSERT in file Ctlcore.cpp, at the end of COleControl::CreateControlWindow, on or near line 662."System Error &H80004005 (-2147467259). Unspecified error"
Microsoft Visual Basic executables do not initialize the common control library (Comctl32.dll) by default, resulting in the CreateEx call failing in COleControl::CreateControlWindow. Calling GetLastError() gives 0x0000057F - Cannot find window class, which indicates the common control library needs to be explicitly initialized.
Inside the InitInstance of your ActiveX control, make a call to:
InitCommonControls(void)
or InitCommonControlsEx(LPINITCOMMONCONTROLSEX lpInitCtrls)
This ensures that Comctl32.dll is loaded and initialized, regardless of the container the control is running in.Private Declare Sub InitCommonControls Lib "comctl32.dll" ()
InitCommonControls
in the Form_Load method.This behavior is by design.
Additional query words: comctl32.dll MFC VB
Keywords : kbole kbActiveX kbCmnCtrls kbMFC kbVBp kbVBp500 kbVBp600 kbVC kbVC500 kbVC600 kbDSupport
Version : WINDOWS:5.0,6.0; winnt:5.0,6.0
Platform : WINDOWS winnt
Issue type : kbprb
Last Reviewed: July 21, 1999