Click here to Skip to main content
15,892,809 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
Posted

1 solution

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
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900