CComCoClass Class
This class provides methods for creating instances of a class, and obtaining its properties.
template<
class T,
const CLSID* pclsid = &CLSID_NULL
>
class CComCoClass
Parameters
T
Your class, derived from CComCoClass.pclsid
A pointer to the CLSID of the object.
Members
Public Methods
Name |
Description |
---|---|
(Static) Creates an instance of the class and queries for an interface. |
|
(Static) Returns rich error information to the client. |
|
(Static) Returns the object's class identifier. |
|
(Static) Override to return the object's description. |
Remarks
CComCoClass provides methods for retrieving an object's CLSID, setting error information, and creating instances of the class. Any class registered in the object map should be derived from CComCoClass.
CComCoClass also defines the default class factory and aggregation model for your object. CComCoClass uses the following two macros:
DECLARE_CLASSFACTORY Declares the class factory to be CComClassFactory.
DECLARE_AGGREGATABLE Declares that your object can be aggregated.
You can override either of these defaults by specifying another macro in your class definition. For example, to use CComClassFactory2 instead of CComClassFactory, specify the DECLARE_CLASSFACTORY2 macro:
class ATL_NO_VTABLE CMyClass2 :
public CComObjectRootEx<CComSingleThreadModel>,
public CComCoClass<CMyClass2, &CLSID_MyClass>,
public IDispatchImpl<IMyClass, &IID_IMyClass, &LIBID_NVC_ATL_COMLib, /*wMajor =*/ 1, /*wMinor =*/ 0>,
public IDispatchImpl<IMyDualInterface, &__uuidof(IMyDualInterface), &LIBID_NVC_ATL_COMLib, /* wMajor = */ 1, /* wMinor = */ 0>
{
public:
DECLARE_CLASSFACTORY2(CMyLicense)
// Remainder of class declaration omitted
Requirements
Header: atlcom.h