1
1
---
2
- description : " Learn more about: RuntimeClass Class "
3
- title : " RuntimeClass Class "
4
- ms.date : " 09/11/2018 "
2
+ description : " Learn more about: RuntimeClass class "
3
+ title : " RuntimeClass class "
4
+ ms.date : 09/28/2022
5
5
ms.topic : " reference"
6
6
f1_keywords : ["implements/Microsoft::WRL::RuntimeClass", "implements/Microsoft::WRL::RuntimeClass::AddRef", "implements/Microsoft::WRL::RuntimeClass::DecrementReference", "implements/Microsoft::WRL::RuntimeClass::GetIids", "implements/Microsoft::WRL::RuntimeClass::GetRuntimeClassName", "implements/Microsoft::WRL::RuntimeClass::GetTrustLevel", "implements/Microsoft::WRL::RuntimeClass::GetWeakReference", "implements/Microsoft::WRL::RuntimeClass::InternalAddRef", "implements/Microsoft::WRL::RuntimeClass::QueryInterface", "implements/Microsoft::WRL::RuntimeClass::Release", "implements/Microsoft::WRL::RuntimeClass::RuntimeClass", "implements/Microsoft::WRL::RuntimeClass::~RuntimeClass"]
7
7
helpviewer_keywords : ["Microsoft::WRL::RuntimeClass class", "Microsoft::WRL::RuntimeClass::AddRef method", "Microsoft::WRL::RuntimeClass::DecrementReference method", "Microsoft::WRL::RuntimeClass::GetIids method", "Microsoft::WRL::RuntimeClass::GetRuntimeClassName method", "Microsoft::WRL::RuntimeClass::GetTrustLevel method", "Microsoft::WRL::RuntimeClass::GetWeakReference method", "Microsoft::WRL::RuntimeClass::InternalAddRef method", "Microsoft::WRL::RuntimeClass::QueryInterface method", "Microsoft::WRL::RuntimeClass::Release method", "Microsoft::WRL::RuntimeClass::RuntimeClass, constructor", "Microsoft::WRL::RuntimeClass::~RuntimeClass, destructor"]
8
8
ms.assetid : d52f9d1a-98e5-41f2-a143-8fb629dd0727
9
9
---
10
- # RuntimeClass Class
10
+ # ` RuntimeClass ` class
11
11
12
12
Represents a WinRT or COM class that inherits the specified interfaces and provides the specified Windows Runtime, classic COM, and weak reference support.
13
13
@@ -22,57 +22,57 @@ template <unsigned int classFlags, typename ...TInterfaces> class RuntimeClass;
22
22
23
23
### Parameters
24
24
25
- *classFlags*<br/>
26
- Optional parameter. A combination of one or more [RuntimeClassType](runtimeclasstype-enumeration.md) 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`. Note, if InhibitFtmBase and FtmBase are both used the object will be agile.
25
+ *` classFlags`*\
26
+ Optional parameter. A combination of one or more [` RuntimeClassType` ](runtimeclasstype-enumeration.md) 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.
27
27
28
- *TInterfaces*<br/>
29
- The list of interfaces the object implements beyond `IUnknown`, `IInspectable` or other interfaces controlled by [RuntimeClassType](runtimeclasstype-enumeration.md). 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`.
28
+ *` TInterfaces`*\
29
+ The list of interfaces the object implements beyond `IUnknown`, `IInspectable` or other interfaces controlled by [` RuntimeClassType` ](runtimeclasstype-enumeration.md). 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`.
30
30
31
31
## Members
32
32
33
- `RuntimeClassInitialize`<br/>
34
- A function which 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`. Note that the `RuntimeClassInitialize` method is not called if the `Make` function template is used to construct the object.
33
+ `RuntimeClassInitialize`\
34
+ 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.
35
35
36
36
### Public Constructors
37
37
38
- | Name | Description |
39
- | -------------------------------------------------- | --------------------------------------------------------------- |
40
- | [RuntimeClass::RuntimeClass](#runtimeclass) | Initializes the current instance of the `RuntimeClass` class. |
41
- | [RuntimeClass::~RuntimeClass](#tilde-runtimeclass) | Deinitializes the current instance of the `RuntimeClass` class. |
38
+ | Name | Description |
39
+ |--|-- |
40
+ | [` RuntimeClass::RuntimeClass` ](#runtimeclass) | Initializes the current instance of the `RuntimeClass` class. |
41
+ | [` RuntimeClass::~RuntimeClass` ](#tilde-runtimeclass) | Deinitializes the current instance of the `RuntimeClass` class. |
42
42
43
43
### Public Methods
44
44
45
- | Name | Description |
46
- | --------------------------------------------------------- | -------------------------------------------------------------------------------------------------- |
47
- | [RuntimeClass::AddRef](#addref) | Increments the reference count for the current `RuntimeClass` object. |
48
- | [RuntimeClass::DecrementReference](#decrementreference) | Decrements the reference count for the current `RuntimeClass` object. |
49
- | [RuntimeClass::GetIids](#getiids) | Gets an array that can contain the interface IDs implemented by the current `RuntimeClass` object. |
50
- | [RuntimeClass::GetRuntimeClassName](#getruntimeclassname) | Gets the runtime class name of the current `RuntimeClass` object. |
51
- | [RuntimeClass::GetTrustLevel](#gettrustlevel) | Gets the trust level of the current `RuntimeClass` object. |
52
- | [RuntimeClass::GetWeakReference](#getweakreference) | Gets a pointer to the weak reference object for the current `RuntimeClass` object. |
53
- | [RuntimeClass::InternalAddRef](#internaladdref) | Increments the reference count to the current `RuntimeClass` object. |
54
- | [RuntimeClass::QueryInterface](#queryinterface) | Retrieves a pointer to the specified interface ID. |
55
- | [RuntimeClass::Release](#release) | Performs a COM Release operation on the current `RuntimeClass` object. |
45
+ | Name | Description |
46
+ |--|-- |
47
+ | [` RuntimeClass::AddRef` ](#addref) | Increments the reference count for the current `RuntimeClass` object. |
48
+ | [` RuntimeClass::DecrementReference` ](#decrementreference) | Decrements the reference count for the current `RuntimeClass` object. |
49
+ | [` RuntimeClass::GetIids` ](#getiids) | Gets an array that can contain the interface IDs implemented by the current `RuntimeClass` object. |
50
+ | [` RuntimeClass::GetRuntimeClassName` ](#getruntimeclassname) | Gets the runtime class name of the current `RuntimeClass` object. |
51
+ | [` RuntimeClass::GetTrustLevel` ](#gettrustlevel) | Gets the trust level of the current `RuntimeClass` object. |
52
+ | [` RuntimeClass::GetWeakReference` ](#getweakreference) | Gets a pointer to the weak reference object for the current `RuntimeClass` object. |
53
+ | [` RuntimeClass::InternalAddRef` ](#internaladdref) | Increments the reference count to the current `RuntimeClass` object. |
54
+ | [` RuntimeClass::QueryInterface` ](#queryinterface) | Retrieves a pointer to the specified interface ID. |
55
+ | [` RuntimeClass::Release` ](#release) | Performs a COM Release operation on the current `RuntimeClass` object. |
56
56
57
57
## Inheritance Hierarchy
58
58
59
- This is an implementation detail.
59
+ The hierarchy is an implementation detail.
60
60
61
61
## Requirements
62
62
63
63
**Header:** implements.h
64
64
65
- **Namespace:** Microsoft::WRL
65
+ **Namespace:** ` Microsoft::WRL`
66
66
67
- ## <a name="tilde-runtimeclass"></a> RuntimeClass::~RuntimeClass
67
+ ## <a name="tilde-runtimeclass"></a> ` RuntimeClass::~RuntimeClass`
68
68
69
69
Deinitializes the current instance of the `RuntimeClass` class.
70
70
71
71
```cpp
72
72
virtual ~RuntimeClass();
73
73
```
74
74
75
- ## <a name =" addref " ></a > RuntimeClass::AddRef
75
+ ## <a name =" addref " ></a > ` RuntimeClass::AddRef `
76
76
77
77
Increments the reference count for the current ` RuntimeClass ` object.
78
78
@@ -83,23 +83,23 @@ STDMETHOD_(
83
83
)();
84
84
```
85
85
86
- ### Return Value
86
+ ### Return value
87
87
88
- S_OK if successful; otherwise, an HRESULT that indicates the error.
88
+ ` S_OK ` if successful; otherwise, an ` HRESULT ` that indicates the error.
89
89
90
- ## <a name =" decrementreference " ></a > RuntimeClass::DecrementReference
90
+ ## <a name =" decrementreference " ></a > ` RuntimeClass::DecrementReference `
91
91
92
92
Decrements the reference count for the current ` RuntimeClass ` object.
93
93
94
94
``` cpp
95
95
ULONG DecrementReference ();
96
96
```
97
97
98
- ### Return Value
98
+ ### Return value
99
99
100
- S_OK if successful; otherwise, an HRESULT that indicates the error.
100
+ ` S_OK ` if successful; otherwise, an ` HRESULT ` that indicates the error.
101
101
102
- ## <a name =" getiids " ></a > RuntimeClass::GetIids
102
+ ## <a name =" getiids " ></a > ` RuntimeClass::GetIids `
103
103
104
104
Gets an array that can contain the interface IDs implemented by the current ` RuntimeClass ` object.
105
105
@@ -113,17 +113,17 @@ STDMETHOD(
113
113
114
114
### Parameters
115
115
116
- *iidCount*<br/>
117
- When this operation completes, the total number of elements in array *iids*.
116
+ *` iidCount`*\
117
+ When this operation completes, the total number of elements in array *` iids` *.
118
118
119
- *iids*<br/>
119
+ *` iids`*\
120
120
When this operation completes, a pointer to an array of interface IDs.
121
121
122
- ### Return Value
122
+ ### Return value
123
123
124
- S_OK if successful; otherwise, E_OUTOFMEMORY.
124
+ ` S_OK` if successful; otherwise, ` E_OUTOFMEMORY` .
125
125
126
- ## <a name="getruntimeclassname"></a> RuntimeClass::GetRuntimeClassName
126
+ ## <a name="getruntimeclassname"></a> ` RuntimeClass::GetRuntimeClassName`
127
127
128
128
Gets the runtime class name of the current `RuntimeClass` object.
129
129
@@ -135,18 +135,18 @@ STDMETHOD( GetRuntimeClassName )(
135
135
136
136
### Parameters
137
137
138
- * runtimeName* < br />
138
+ * ` runtimeName ` * \
139
139
When this operation completes, the runtime class name.
140
140
141
- ### Return Value
141
+ ### Return value
142
142
143
- S_OK if successful; otherwise, an HRESULT that indicates the error.
143
+ ` S_OK ` if successful; otherwise, an ` HRESULT ` that indicates the error.
144
144
145
145
### Remarks
146
146
147
147
An assert error is emitted if ` __WRL_STRICT__ ` or ` __WRL_FORCE_INSPECTABLE_CLASS_MACRO__ ` isn't defined.
148
148
149
- ## <a name =" gettrustlevel " ></a > RuntimeClass::GetTrustLevel
149
+ ## <a name =" gettrustlevel " ></a > ` RuntimeClass::GetTrustLevel `
150
150
151
151
Gets the trust level of the current ` RuntimeClass ` object.
152
152
@@ -158,18 +158,18 @@ STDMETHOD(GetTrustLevel)(
158
158
159
159
### Parameters
160
160
161
- * trustLvl* < br />
161
+ * ` trustLvl ` * \
162
162
When this operation completes, the trust level of the current ` RuntimeClass ` object.
163
163
164
- ### Return Value
164
+ ### Return value
165
165
166
- Always S_OK.
166
+ Always ` S_OK ` .
167
167
168
168
### Remarks
169
169
170
170
An assert error is emitted if ` __WRL_STRICT__ ` or ` __WRL_FORCE_INSPECTABLE_CLASS_MACRO__ ` isn't defined.
171
171
172
- ## <a name =" getweakreference " ></a > RuntimeClass::GetWeakReference
172
+ ## <a name =" getweakreference " ></a > ` RuntimeClass::GetWeakReference `
173
173
174
174
Gets a pointer to the weak reference object for the current ` RuntimeClass ` object.
175
175
@@ -181,26 +181,26 @@ STDMETHOD(
181
181
182
182
### Parameters
183
183
184
- *weakReference*<br/>
184
+ *` weakReference`*\
185
185
When this operation completes, a pointer to a weak reference object.
186
186
187
- ### Return Value
187
+ ### Return value
188
188
189
- Always S_OK.
189
+ Always ` S_OK` .
190
190
191
- ## <a name="internaladdref"></a> RuntimeClass::InternalAddRef
191
+ ## <a name="internaladdref"></a> ` RuntimeClass::InternalAddRef`
192
192
193
193
Increments the reference count to the current `RuntimeClass` object.
194
194
195
195
```cpp
196
196
ULONG InternalAddRef();
197
197
```
198
198
199
- ### Return Value
199
+ ### Return value
200
200
201
201
The resulting reference count.
202
202
203
- ## <a name =" queryinterface " ></a > RuntimeClass::QueryInterface
203
+ ## <a name =" queryinterface " ></a > ` RuntimeClass::QueryInterface `
204
204
205
205
Retrieves a pointer to the specified interface ID.
206
206
@@ -214,17 +214,17 @@ STDMETHOD(
214
214
215
215
### Parameters
216
216
217
- *riid*<br/>
217
+ *` riid`*\
218
218
An interface ID.
219
219
220
- *ppvObject*<br/>
221
- When this opereation completes, a pointer to the interface specified by the *riid* parameter.
220
+ *` ppvObject`*\
221
+ When this operation completes, a pointer to the interface specified by the *` riid` * parameter.
222
222
223
- ### Return Value
223
+ ### Return value
224
224
225
- S_OK if successful; otherwise, an HRESULT that indicates the error.
225
+ ` S_OK` if successful; otherwise, an ` HRESULT` that indicates the error.
226
226
227
- ## <a name="release"></a> RuntimeClass::Release
227
+ ## <a name="release"></a> ` RuntimeClass::Release`
228
228
229
229
Performs a COM Release operation on the current `RuntimeClass` object.
230
230
@@ -235,15 +235,15 @@ STDMETHOD_(
235
235
)();
236
236
```
237
237
238
- ### Return Value
238
+ ### Return value
239
239
240
- S_OK if successful; otherwise, an HRESULT that indicates the error.
240
+ ` S_OK ` if successful; otherwise, an ` HRESULT ` that indicates the error.
241
241
242
242
### Remarks
243
243
244
244
If the reference count becomes zero, the ` RuntimeClass ` object is deleted.
245
245
246
- ## <a name =" runtimeclass " ></a > RuntimeClass::RuntimeClass
246
+ ## <a name =" runtimeclass " ></a > ` RuntimeClass::RuntimeClass `
247
247
248
248
Initializes the current instance of the ` RuntimeClass ` class.
249
249
0 commit comments