| description | Learn more about: ClassFactory Class | ||||||
|---|---|---|---|---|---|---|---|
| title | ClassFactory Class | ||||||
| ms.date | 10/03/2018 | ||||||
| ms.topic | reference | ||||||
| f1_keywords |
|
||||||
| helpviewer_keywords |
|
||||||
| ms.assetid | f13e6bce-722b-4f18-b7cf-3ffa6345c1db |
Implements the basic functionality of the IClassFactory interface.
template <
typename I0 = Details::Nil,
typename I1 = Details::Nil,
typename I2 = Details::Nil
>
class ClassFactory :
public Details::RuntimeClass<
typename Details::InterfaceListHelper<
IClassFactory,
I0,
I1,
I2,
Details::Nil
>::TypeT,
RuntimeClassFlags<ClassicCom | InhibitWeakReference>,
false
>;I0
The zeroth interface.
I1
The first interface.
I2
The second interface.
Utilize ClassFactory to provide a user-defined factory implementation.
The following programming pattern demonstrates how to use the Implements structure to specify more than three interfaces on a class factory.
struct MyFactory : ClassFactory<Implements<I1, I2, I3>, I4, I5>
| Name | Description |
|---|---|
| ClassFactory::ClassFactory |
| Name | Description |
|---|---|
| ClassFactory::AddRef | Increments the reference count for the current ClassFactory object. |
| ClassFactory::LockServer | Increments or decrements the number of underlying objects that are tracked by the current ClassFactory object. |
| ClassFactory::QueryInterface | Retrieves a pointer to the interface specified by parameter. |
| ClassFactory::Release | Decrements the reference count for the current ClassFactory object. |
I0
ChainInterfaces
I0
RuntimeClassBase
ImplementsHelper
DontUseNewUseMake
RuntimeClassFlags
RuntimeClassBaseT
RuntimeClass
ClassFactory
Header: module.h
Namespace: Microsoft::WRL
Increments the reference count for the current ClassFactory object.
STDMETHOD_(
ULONG,
AddRef
)();S_OK if successful; otherwise, an HRESULT that describes the failure.
WRL_NOTHROW ClassFactory();Increments or decrements the number of underlying objects that are tracked by the current ClassFactory object.
STDMETHOD(
LockServer
)(BOOL fLock);fLock
true to increment the number of tracked objects. false to decrement the number of tracked objects.
S_OK if successful; otherwise, E_FAIL.
ClassFactory keeps track of objects in an underlying instance of the Module class.
Retrieves a pointer to the interface specified by parameter.
STDMETHOD(
QueryInterface
)(REFIID riid, _Deref_out_ void **ppvObject);riid
An interface ID.
ppvObject
When this operation completes, a pointer to the interface specified by parameter riid.
S_OK if successful; otherwise, an HRESULT that describes the failure.
Decrements the reference count for the current ClassFactory object.
STDMETHOD_(
ULONG,
Release
)();S_OK if successful; otherwise, an HRESULT that describes the failure.