问题描述
我无法使用以下步骤在VC6中添加我的activex
1.创建一个MFCActiveXControlWizard项目。
2.Goto Project - AddToProject-ComponentAndControls-RegisteredActiveXcontrol;选择我的ActiveX控件
我得到以下错误
错误C2556:'class CString __thiscall Myclass: :GetClsid(void)':重载函数的区别仅在于'const struct _GUID&__ thiscall Myclass :: GetClsid(void)'的返回类型
我的clsid属性ActiveX。
即使微软添加一个Getclsid()如下所示导致问题。
CGenocx类:公共CWnd
{
受保护:
DECLARE_DYNCREATE(CGenocx)
公开:
CLSID const&GetClsid()
{
静态CLSID const clsid
= {0x20DD1B9E,0x87C4,0x11D1,{0x8B,0xE3 ,0x0,0x0,0xF8,0x75,0x4D,0xA1}};
返回clsid;
}
//此代码由控制向导生成。
//它在Create的调用中包含对CreateControl的调用。
virtua l BOOL Create(LPCTSTR lpszClassName,LPCTSTR lpszWindowName,DWORD dwStyle,
const RECT&rect,CWnd * pParentWnd,UINT nID,
CCreateContext * pContext = NULL)
{
UNREFERENCED_PARAMETER(pContext);
UNREFERENCED_PARAMETER(lpszClassName);
返回CreateControl( GetClsid(),lpszWindowName,dwStyle,rect,pParentWnd,nID);
}
}
请给出建议如何解决这个问题?
谢谢
Antoni
Hi,
I could not add my activex in VC6 using below steps
1.Create a MFCActiveXControlWizard project.
2.Goto Project--AddToProject-ComponentAndControls-RegisteredActiveXcontrol; select My ActiveX control
I get below error as
error C2556: 'class CString __thiscall Myclass::GetClsid(void)' : overloaded function differs only by return type from 'const struct _GUID &__thiscall Myclass::GetClsid(void)'
I have clsid property in my ActiveX.
Even Microsoft add a Getclsid() as given below which is causing the issue.
class CGenocx : public CWnd
{
protected:
DECLARE_DYNCREATE(CGenocx)
public:
CLSID const& GetClsid()
{
static CLSID const clsid
= { 0x20DD1B9E, 0x87C4, 0x11D1, { 0x8B, 0xE3, 0x0, 0x0, 0xF8, 0x75, 0x4D, 0xA1 } };
return clsid;
}
// This code is generated by the Control Wizard.
// It wraps the call to CreateControl in the call to Create.
virtual BOOL Create(LPCTSTR lpszClassName, LPCTSTR lpszWindowName, DWORD dwStyle,
const RECT& rect, CWnd* pParentWnd, UINT nID,
CCreateContext* pContext = NULL)
{
UNREFERENCED_PARAMETER(pContext);
UNREFERENCED_PARAMETER(lpszClassName);
return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect, pParentWnd, nID);
}
}
Please give suggestion how to solve this?
Thanks
Antoni
推荐答案
这篇关于无法在VC6中的MFCActiveXControlWizard项目中添加我的activeX的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!