Share via


DECLARE_CLASSFACTORY2

 

Declares CComClassFactory2 to be the class factory.

Syntax

      DECLARE_CLASSFACTORY2( 
   lic  
)

Parameters

  • lic
    [in] A class that implements VerifyLicenseKey, GetLicenseKey, and IsLicenseValid.

Remarks

CComCoClass includes the DECLARE_CLASSFACTORY macro, which specifies CComClassFactory as the default class factory. However, by including the DECLARE_CLASSFACTORY2 macro in your object's class definition, you override this default.

Example

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

See Also

Aggregation and Class Factory Macros
ATL Macros
DECLARE_CLASSFACTORY_EX
DECLARE_CLASSFACTORY_AUTO_THREAD
DECLARE_CLASSFACTORY_SINGLETON