You receive a "System Error &H80004005" error message from a Visual Basic 6.0 application when an MFC ActiveX control subclasses any of the window classes implemented by Comctl32.dll (223152)
The information in this article applies to:
- The Microsoft Foundation Classes (MFC), when used with:
- Microsoft Visual C++, 32-bit Editions 5.0
- Microsoft Visual C++, 32-bit Editions 6.0
- Microsoft Visual Basic Learning Edition for Windows 5.0
- Microsoft Visual Basic Learning Edition for Windows 6.0
- Microsoft Visual Basic Professional Edition for Windows 5.0
- Microsoft Visual Basic Professional Edition for Windows 6.0
- Microsoft Visual Basic Enterprise Edition for Windows 5.0
- Microsoft Visual Basic Enterprise Edition for Windows 6.0
This article was previously published under Q223152 SYMPTOMS 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 6.0 .exe. "System Error
&H80004005 (-2147467259). Unspecified error" 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. This problem
occurs only when you build an .exe from Visual Basic 6.0 and run it from
outside the Visual Basic development environment. CAUSE 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. RESOLUTION 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. Instead of calling
InitCommonControls from the control's code, you can also call it directly from
the Visual Basic client application:
In some situations, this might be too late to initialize the
common controls library. Therefore, it is recommended to add this call in the
InitInstance of the control. STATUS This behavior is by design.
Modification Type: | Major | Last Reviewed: | 4/28/2005 |
---|
Keywords: | kberrmsg kbtshoot kbCmnCtrls kbCtrl kbprb KB223152 kbAudDeveloper |
---|
|