本文介绍了“createinstance”的C ++ COM模糊性来自“ccomcoclass”和“stddispatchimpl”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
Sorry somehow some text is missing in my previous question. Thanks for bearing with me. Here is complete question-
Working on VS2013.
I have created a classs-
class ATL_NO_VTABLE CMyClass :
public CComObjectRootEx <<CComMultiThreadModel>>,
public CComCoClass<<CMyClass, CLSID_MyClass&>>,
public IDispatchImpl<<IMyInterface3, IID_IMyInterface3, LIBID_myLib, 1, 0>>,
public StdDispatchImpl<<CMyClass>>;
In another cpp file I'm creating instance as follows-
CMyClass::CreateInstance(_pMyClass);
<b>Here I get error, saying:
error C2385: ambiguous access of 'CreateInstance'
could be the 'CreateInstance' in base 'ATL::CComCoClass<<CMyClass, CLSID_MyClass>>'
or could be the 'CreateInstance' in base 'StdDispatchImpl<<CMyClass&>>
I need all the base class to derive from for my development purpose.
Kindly advice how to resolve the ambiguity.
If I exclude last line from my class (i.e. public StdDispatchImpl <<CMyClass>>), Compiler will be very happy to compile it successfully.
note: I need to use CreateInstance from StdDispatchImpl<<CMyClass&>>
Thanks,
Praveen
什么我试过了:
google ..
我需要所有的基类来源于我的发展目的。
请建议如何解决歧义。
注意:我需要使用 CreateInstance >'StdDispatchImpl<< CMyClass>>'
What I have tried:
google..
I need all the base class to derive from for my development purpose.
Kindly advice how to resolve the ambiguity.
note: I need to use "CreateInstance" from 'StdDispatchImpl<<CMyClass>>'
推荐答案
这篇关于“createinstance”的C ++ COM模糊性来自“ccomcoclass”和“stddispatchimpl”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!