The information in this article applies to:
SYMPTOMS
When using #import to create smart pointers for an ActiveX server, you may see C2146 and C2501 compiler errors in either of the .tlh or .tli files. This will happen if the type library used IFontDisp and IPictureDisp interfaces.
CAUSEIFontDisp and IPictureDisp are just typedefs for the interfaces Font and Picture respectively. The header file Comdef.h incorrectly declares smart pointer classes for the synonyms IFontDisp and IPictureDisp rather than the actual interface types Font and Picture. This is what results in the compilation error. RESOLUTION
In order to get around this error, #import the typelib Stdole2.tlb prior to importing the ActiveX servers typelib and make sure that they exist in the same namespace. For example, if you were using the CIRC3 MFC ActiveX control, employ the following code as the workaround:
STATUSMicrosoft has confirmed this to be a bug in the Microsoft products listed at the beginning of this article. MORE INFORMATIONSteps to Reproduce BehaviorOne case where this issue showed up involved using #import to create smart pointers for the Circ3 MFC ActiveX control sample. The steps to reproduce the behavior are shown here:
REFERENCESQ185284 FIX: #import Does not Correctly Handle GUID Parameters Additional query words:
Keywords : kbAutomation kbCOMt kbVC kbGrpMFCATL kbSmartPtr |
Last Reviewed: August 23, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |