DECLARE_CLASSFACTORY_SINGLETON

Declares CComClassFactorySingleton to be the class factory.

DECLARE_CLASSFACTORY_SINGLETON( 
      obj  
)

Parameters

  • obj
    [in] The name of your class object.

Remarks

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

Example

class ATL_NO_VTABLE CMySingletonClass :
   public CComObjectRootEx<CComSingleThreadModel>,
   public CComCoClass<CMySingletonClass, &CLSID_MySingletonClass>,
   public IMySingletonClass
{
public:
   DECLARE_CLASSFACTORY_SINGLETON(CMySingletonClass)

   // Remainder of class declaration omitted.

Requirements

Header: atlcom.h

See Also

Concepts

Aggregation and Class Factory Macros

ATL Macros

DECLARE_CLASSFACTORY2

DECLARE_CLASSFACTORY_EX

DECLARE_CLASSFACTORY_AUTO_THREAD