Hi, I am new to COM programming and I am having difficulty creating derived COM classes that uses other COM class as a base class.
I am trying to write class in the C++ end to be used in Visual Basic. I am writing COM ATL class in a DLL and referencing it in VB. I am able to create "regular" COM class use it in the VB end. But when I create a COM class derived from another COM class (in the same DLL), the compiler throws errors, which I have traced to lines 26, 43, and 51 (see code below).
I got around the problem by commenting out those lines, and it would compile fine. The problem is when I start creating the classes. I am able to create the base class, but I am unable to create the derived class.
I have been trying to figure out why I am having a problem and how I can fix it, but I just don't know enough about COM.
This is the base class:
1 class ATL_NO_VTABLE CBaseClass :
2 public CComObjectRootEx,
3 public CComCoClass,
4 public IDispatchImpl
21 // IBaseClass
This is the derived class:
24 class ATL_NO_VTABLE CDerivedClass :
25 public CBaseClass,
26 public CComObjectRootEx,
27 public CComCoClass,
28 public IDispatchImpl
33 : CBaseClass()
46 // IDerivedClass
This is code from testcom.cpp (the name of the project/DLL):
50 OBJECT_ENTRY(CLSID_BaseClass, CBaseClass)
51 OBJECT_ENTRY(CLSID_DerivedClass, CDerivedClass)