FIX: ATL ActiveX Controls Fail on Windows 95 When Hosting ActiveX Controls (239916)
The information in this article applies to:
- The Microsoft Active Template Library (ATL) 3.0
This article was previously published under Q239916 SYMPTOMS
When running Windows 95 without DCOM installed, an ATL AppWizard generated composite control will not create properly if it hosts any ActiveX controls whether they are licensed or unlicensed.
CAUSE
When ATL calls CoCreateInstance to create the contained controls it uses CLSCTX_SERVER for the context parameter. CLSCTX_SERVER is a combination of CLSCTX_INPROC_SERVER, CLSCTX_LOCAL_SERVER and CLSCTX_REMOTE_SERVER.
CoCreateInstance will look at CLSCTX_REMOTE_SERVER first because this is not valid on Windows 95 without DCOM; it will cause the creation of the contained control to fail. This will ultimately cause the composite control to fail during creation also.
RESOLUTION
Following are three workarounds for this situation. - Open ATLHost.h from the \atl\include directory:
- Find the function CreateNormalizedObject in Atlhost.h.
- In CreateNormalizedObject, find the calls to CoCreateInstance on lines 28, 43 and 49. Change the parameter CLSCTX_SERVER to CLSCTX_INPROC_SERVER.
- Save the modified ATLHost.h file.
- Rebuild the project.
- Comment out the following lines in Stdafx.h:
/* comment this block of code out if you intend to run without DCOM!
#define STRICT
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0400
#endif
*/
- Install DCOM for Windows 95. You can get it from the following Web site:
Windows Update Site. You could also install Internet Explorer 4 or higher as it will install DCOM.
STATUSMicrosoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.
This problem was corrected in Microsoft Visual C++ .NET.
Modification Type: | Major | Last Reviewed: | 10/15/2002 |
---|
Keywords: | kbBug kbContainer kbCtrlCreate kbDCOM kbDlg kbLicensing kbNoUpdate KB239916 |
---|
|