This documentation is archived and is not being maintained.

CComClassFactoryAutoThread Class

This class implements the IClassFactory interface, and allows objects to be created in multiple apartments.

class CComClassFactoryAutoThread : public IClassFactory, 
public CComObjectRootEx< CComGlobalsThreadModel >

Remarks

CComClassFactoryAutoThread is similar to CComClassFactory, but allows objects to be created in multiple apartments. To take advantage of this support, derive your EXE module from CComAutoThreadModule.

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 CComClassFactoryAutoThread, specify the DECLARE_CLASSFACTORY_AUTO_THREAD macro in your object's class definition. For example:

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

   ...
};

Requirements

Header: atlcom.h

See Also

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

Show: