无法在VC6中的MFCActiveXControlWizard项目中添加我的activeX [英] could not add my activeX in MFCActiveXControlWizard project in VC6

查看:173
本文介绍了无法在VC6中的MFCActiveXControlWizard项目中添加我的activeX的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我无法使用以下步骤在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

推荐答案

你已经展示了2个花括号在Create(..){}}的部分?

这是一个错误(在你的代码中被删除了吗?)



BOOL创建(LPCTSTR lpszWindowName,DWORD dwStyle,...................

BOOL bStorage = FALSE,

BSTR bstrLicKey = NULL)

{返回CreateControl(GetClsid(),lpszWindowName,dwStyle,rect,

pParentWnd,nID,........... .............);}



您是否尝试在此标题文件中删除这些行?

UNREFERENCED_PARAMETER(pContext);

UNREFERENCED_PARAMETER(lpszClassName);



您是否在Activex Control创建中包含了initguid.h:DLL Exports 。实现cpp文件?我开发了ATL COM
You have shown 2 closing curly braces in the segment of Create(..) { }}?
Is it an error (following is erased in your code?)

"BOOL Create(LPCTSTR lpszWindowName, DWORD dwStyle,...................
BOOL bStorage = FALSE,
BSTR bstrLicKey = NULL)
{ return CreateControl(GetClsid(), lpszWindowName, dwStyle, rect,
pParentWnd, nID, ........................ ); }"

Have you tried deleting these lines in this header file?
UNREFERENCED_PARAMETER(pContext);
UNREFERENCED_PARAMETER(lpszClassName);

Did you include initguid.h in your Activex Control creation: DLL Exports. implementation cpp file? I developed ATL COM


这篇关于无法在VC6中的MFCActiveXControlWizard项目中添加我的activeX的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆