Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Important This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here.

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.

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:

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 CMyClass : ..., 
   public CComCoClass<CMyClass, &CLSID_CMyClass>
{
public:
   DECLARE_CLASSFACTORY2(CMyLicense)

   ...
};

Header: atlcom.h

Community Additions

ADD
Show:
© 2015 Microsoft