Microsoft KB Archive/832687

= You may receive the &quot;ATLASSERT&quot; error message while hosting an ActiveX control in a COM DLL that is statically linked to the ATL in Visual C++ .NET or in Visual C++ 2005 =

Article ID: 832687

Article Last Modified on 4/29/2007

-

APPLIES TO


 * Microsoft Visual C++ 2005 Express Edition
 * Microsoft Visual C++ .NET 2003 Standard Edition
 * Microsoft Visual C++ .NET 2002 Standard Edition

-





SYMPTOMS
When you try to create and to display the Microsoft Internet Explorer control or the Microsoft Foundation Classes (MFC) ActiveX Controls that request ambient properties and that link statically to the Active Template Library (ATL) in an COM DLL application, you may receive the following error message:

ATLASSERT(!InlineIsEqualGUID(*m_plibid, GUID_NULL) && &quot;Did you forget to pass the LIBID to CComModule::Init?&quot;);

from line 3552 in ATLCOM.H



MORE INFORMATION
You may receive the error message that is mentioned in the &quot;Summary&quot; section only if you link statically to the ATL library in a COM DLL application with MFC support. If you dynamically link to the ATL library or if your application is of the EXE type instead of the DLL type, you may not receive this error message. However, you may experience other problems, such as a heap corruption or a memory leak.

Additionally, you may receive the error message when you try to create controls, such as the Internet Explorer control, the MFC ActiveX Controls, and controls that request ambient properties. You may not receive the error message when you create controls, such as the Calendar control and the Grid control.

This problem occurs because the IAxWinAmbientDispatchEx interface is not included if you statically link to the ATL. The IAxWinAmbientDispatchEx interface implements supplemental ambient properties for a hosted control.

The documentation for the IAxWinAmbientDispatchEx interface that is mentioned in the &quot;References&quot; section notes that you must add the following code after the other import statements in your .idl file: import &quot;atliface.idl&quot; You also must add the following code in the library block: interface IAxWinAmbientDispatchEx; However, you may still receive the following error message:

LIBID is not getting set

This error message occurs because of the way that the class override is handled in the ATL. This is a bug. To work around this problem, verify that you declared the LIBID of your library in your project as shown in the following code sample: DECLARE_LIBID(LIBID_MyProjectLib) Also, verify that you set the LIBID in your project by using either of the following code sample statements: _Module.Init(ObjectMap, hInstance, &LIBID_MyProjectLib); _AtlModule.m_libid = LIBID_MyProjectLib; Note In the previous code sample,  is a placeholder for the name of your library.

Additional query words: IAxWinAmbientDispatchEx ATLASSERT ActiveX Control Internet Explorer Control ATL MFC Static Linking

