Export (0) Print
Expand All

CComClassFactorySingleton Class

This class derives from CComClassFactory and uses CComObjectGlobal to construct a single object.

template<
   class T
>
class CComClassFactorySingleton :
   public CComClassFactory

Parameters

T
Your class.

CComClassFactorySingleton derives from CComClassFactory and uses CComObjectGlobal to construct a single object. Each call to the CreateInstance method simply queries this object for an interface pointer.

Remarks

ATL objects normally acquire a class factory by deriving from CComCoClass. This class includes the macro DECLARE_CLASSFACTORY, which declares CComClassFactory as the default class factory. To use CComClassFactorySingleton, specify the DECLARE_CLASSFACTORY_SINGLETON macro in your object's class definition. For example:

class CMyClass : ..., public CComCoClass< ... >
{
public:
   DECLARE_CLASSFACTORY_SINGLETON(CMyClass)

   ...
};

Requirements

Header: atlcom.h

See Also

Class Members | IClassFactory | CComClassFactory2 | CComClassFactoryAutoThread | CComObjectRootEx | CComGlobalsThreadModel | ATL Class Overview

Show:
© 2014 Microsoft