description | title | ms.date | ms.topic | f1_keywords | helpviewer_keywords | ms.assetid | ||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Learn more about: RuntimeClass class |
RuntimeClass class |
09/28/2022 |
reference |
|
|
d52f9d1a-98e5-41f2-a143-8fb629dd0727 |
Represents a WinRT or COM class that inherits the specified interfaces and provides the specified Windows Runtime, classic COM, and weak reference support.
This class provides the boilerplate implementation of WinRT and COM classes, providing the implementation of QueryInterface
, AddRef
, Release
etc., manages the reference count of the module and has support for providing the class factory for activatable objects.
template <typename ...TInterfaces> class RuntimeClass
template <unsigned int classFlags, typename ...TInterfaces> class RuntimeClass;
classFlags
Optional parameter. A combination of one or more RuntimeClassType
enumeration values. The __WRL_CONFIGURATION_LEGACY__
macro can be defined to change the default value of classFlags
for all runtime classes in the project. If defined, RuntimeClass
instances are non-agile by default. When not defined, RuntimeClass
instances are agile by default. To avoid ambiguity, always specify the Microsoft::WRL::FtmBase
in TInterfaces
or RuntimeClassType::InhibitFtmBase
. If InhibitFtmBase
and FtmBase
are both used, the object will be agile.
TInterfaces
The list of interfaces the object implements beyond IUnknown
, IInspectable
or other interfaces controlled by RuntimeClassType
. It also may list other classes to be derived from, notably Microsoft::WRL::FtmBase
to make the object agile and cause it to implement IMarshal
.
RuntimeClassInitialize
A function that initializes the object if the MakeAndInitialize
function template is used to construct the object. It returns S_OK
if the object was successfully initialized, or a COM error code if initialization failed. The COM error code is propagated as the return value of MakeAndInitialize
. The RuntimeClassInitialize
method isn't called if the Make
function template is used to construct the object.
Name | Description |
---|---|
RuntimeClass::RuntimeClass |
Initializes the current instance of the RuntimeClass class. |
RuntimeClass::~RuntimeClass |
Deinitializes the current instance of the RuntimeClass class. |
Name | Description |
---|---|
RuntimeClass::AddRef |
Increments the reference count for the current RuntimeClass object. |
RuntimeClass::DecrementReference |
Decrements the reference count for the current RuntimeClass object. |
RuntimeClass::GetIids |
Gets an array that can contain the interface IDs implemented by the current RuntimeClass object. |
RuntimeClass::GetRuntimeClassName |
Gets the runtime class name of the current RuntimeClass object. |
RuntimeClass::GetTrustLevel |
Gets the trust level of the current RuntimeClass object. |
RuntimeClass::GetWeakReference |
Gets a pointer to the weak reference object for the current RuntimeClass object. |
RuntimeClass::InternalAddRef |
Increments the reference count to the current RuntimeClass object. |
RuntimeClass::QueryInterface |
Retrieves a pointer to the specified interface ID. |
RuntimeClass::Release |
Performs a COM Release operation on the current RuntimeClass object. |
The hierarchy is an implementation detail.
Header: implements.h
Namespace: Microsoft::WRL
Deinitializes the current instance of the RuntimeClass
class.
virtual ~RuntimeClass();
Increments the reference count for the current RuntimeClass
object.
STDMETHOD_(
ULONG,
AddRef
)();
S_OK
if successful; otherwise, an HRESULT
that indicates the error.
Decrements the reference count for the current RuntimeClass
object.
ULONG DecrementReference();
S_OK
if successful; otherwise, an HRESULT
that indicates the error.
Gets an array that can contain the interface IDs implemented by the current RuntimeClass
object.
STDMETHOD(
GetIids
)
(_Out_ ULONG *iidCount,
_Deref_out_ _Deref_post_cap_(*iidCount) IID **iids);
iidCount
When this operation completes, the total number of elements in array iids
.
iids
When this operation completes, a pointer to an array of interface IDs.
S_OK
if successful; otherwise, E_OUTOFMEMORY
.
Gets the runtime class name of the current RuntimeClass
object.
STDMETHOD( GetRuntimeClassName )(
_Out_ HSTRING* runtimeName
);
runtimeName
When this operation completes, the runtime class name.
S_OK
if successful; otherwise, an HRESULT
that indicates the error.
An assert error is emitted if __WRL_STRICT__
or __WRL_FORCE_INSPECTABLE_CLASS_MACRO__
isn't defined.
Gets the trust level of the current RuntimeClass
object.
STDMETHOD(GetTrustLevel)(
_Out_ TrustLevel* trustLvl
);
trustLvl
When this operation completes, the trust level of the current RuntimeClass
object.
Always S_OK
.
An assert error is emitted if __WRL_STRICT__
or __WRL_FORCE_INSPECTABLE_CLASS_MACRO__
isn't defined.
Gets a pointer to the weak reference object for the current RuntimeClass
object.
STDMETHOD(
GetWeakReference
)(_Deref_out_ IWeakReference **weakReference);
weakReference
When this operation completes, a pointer to a weak reference object.
Always S_OK
.
Increments the reference count to the current RuntimeClass
object.
ULONG InternalAddRef();
The resulting reference count.
Retrieves a pointer to the specified interface ID.
STDMETHOD(
QueryInterface
)
(REFIID riid,
_Deref_out_ void **ppvObject);
riid
An interface ID.
ppvObject
When this operation completes, a pointer to the interface specified by the riid
parameter.
S_OK
if successful; otherwise, an HRESULT
that indicates the error.
Performs a COM Release operation on the current RuntimeClass
object.
STDMETHOD_(
ULONG,
Release
)();
S_OK
if successful; otherwise, an HRESULT
that indicates the error.
If the reference count becomes zero, the RuntimeClass
object is deleted.
Initializes the current instance of the RuntimeClass
class.
RuntimeClass();