Skip to content

Commit 2965092

Browse files
authored
Merge pull request #5409 from Rageking8/improve-idispeventimpl-class-reference
Improve `IDispEventImpl` class reference
2 parents b56fc1f + c1ee2b7 commit 2965092

File tree

1 file changed

+63
-66
lines changed

1 file changed

+63
-66
lines changed
Lines changed: 63 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
---
2-
description: "Learn more about: IDispEventImpl Class"
32
title: "IDispEventImpl Class"
4-
ms.date: "11/04/2016"
3+
description: "Learn more about: IDispEventImpl Class"
4+
ms.date: 11/04/2016
55
f1_keywords: ["IDispEventImpl", "ATLCOM/ATL::IDispEventImpl", "ATLCOM/ATL::IDispEventImpl::IDispEventImpl", "ATLCOM/ATL::IDispEventImpl::GetFuncInfoFromId", "ATLCOM/ATL::IDispEventImpl::GetIDsOfNames", "ATLCOM/ATL::IDispEventImpl::GetTypeInfo", "ATLCOM/ATL::IDispEventImpl::GetTypeInfoCount", "ATLCOM/ATL::IDispEventImpl::GetUserDefinedType"]
66
helpviewer_keywords: ["IDispEventImpl class"]
7-
ms.assetid: a64b5288-35cb-4638-aad6-2d15b1c7cf7b
87
---
9-
# IDispEventImpl Class
8+
# `IDispEventImpl` Class
109

1110
This class provides implementations of the `IDispatch` methods.
1211

@@ -15,7 +14,7 @@ This class provides implementations of the `IDispatch` methods.
1514
1615
## Syntax
1716

18-
```
17+
```cpp
1918
template <UINT nID, class T,
2019
const IID* pdiid = &IID_NULL,
2120
const GUID* plibid = &GUID_NULL,
@@ -27,89 +26,89 @@ class ATL_NO_VTABLE IDispEventImpl : public IDispEventSimpleImpl<nID, T, pdiid>
2726
2827
#### Parameters
2928
30-
*nID*<br/>
29+
*`nID`*\
3130
A unique identifier for the source object. When `IDispEventImpl` is the base class for a composite control, use the resource ID of the desired contained control for this parameter. In other cases, use an arbitrary positive integer.
3231
33-
*T*<br/>
32+
*`T`*\
3433
The user's class, which is derived from `IDispEventImpl`.
3534
36-
*pdiid*<br/>
37-
The pointer to the IID of the event dispinterface implemented by this class. This interface must be defined in the type library denoted by *plibid*, *wMajor*, and *wMinor*.
35+
*`pdiid`*\
36+
The pointer to the IID of the event dispinterface implemented by this class. This interface must be defined in the type library denoted by *`plibid`*, *`wMajor`*, and *`wMinor`*.
3837
39-
*plibid*<br/>
40-
A pointer to the type library that defines the dispatch interface pointed to by *pdiid*. If **&GUID_NULL**, the type library will be loaded from the object sourcing the events.
38+
*`plibid`*\
39+
A pointer to the type library that defines the dispatch interface pointed to by *`pdiid`*. If **`&GUID_NULL`**, the type library will be loaded from the object sourcing the events.
4140
42-
*wMajor*<br/>
41+
*`wMajor`*\
4342
The major version of the type library. The default value is 0.
4443
45-
*wMinor*<br/>
44+
*`wMinor`*\
4645
The minor version of the type library. The default value is 0.
4746
48-
*tihclass*<br/>
49-
The class used to manage the type information for *T*. The default value is a class of type `CComTypeInfoHolder`; however, you can override this template parameter by providing a class of a type other than `CComTypeInfoHolder`.
47+
*`tihclass`*\
48+
The class used to manage the type information for *`T`*. The default value is a class of type `CComTypeInfoHolder`; however, you can override this template parameter by providing a class of a type other than `CComTypeInfoHolder`.
5049
5150
## Members
5251
5352
### Public Typedefs
5453
5554
|Name|Description|
5655
|----------|-----------------|
57-
|[IDispEventImpl::_tihclass](../../atl/reference/idispeventimpl-class.md)|The class used to manage the type information. By default, `CComTypeInfoHolder`.|
56+
|[`IDispEventImpl::_tihclass`](#_tihclass)|The class used to manage the type information. By default, `CComTypeInfoHolder`.|
5857
5958
### Public Constructors
6059
6160
|Name|Description|
6261
|----------|-----------------|
63-
|[IDispEventImpl::IDispEventImpl](#idispeventimpl)|The constructor.|
62+
|[`IDispEventImpl::IDispEventImpl`](#idispeventimpl)|The constructor.|
6463
6564
### Public Methods
6665
6766
|Name|Description|
6867
|----------|-----------------|
69-
|[IDispEventImpl::GetFuncInfoFromId](#getfuncinfofromid)|Locates the function index for the specified dispatch identifier.|
70-
|[IDispEventImpl::GetIDsOfNames](#getidsofnames)|Maps a single member and an optional set of argument names to a corresponding set of integer DISPIDs.|
71-
|[IDispEventImpl::GetTypeInfo](#gettypeinfo)|Retrieves the type information for an object.|
72-
|[IDispEventImpl::GetTypeInfoCount](#gettypeinfocount)|Retrieves the number of type information interfaces.|
73-
|[IDispEventImpl::GetUserDefinedType](#getuserdefinedtype)|Retrieves the basic type of a user-defined type.|
68+
|[`IDispEventImpl::GetFuncInfoFromId`](#getfuncinfofromid)|Locates the function index for the specified dispatch identifier.|
69+
|[`IDispEventImpl::GetIDsOfNames`](#getidsofnames)|Maps a single member and an optional set of argument names to a corresponding set of integer `DISPID`s.|
70+
|[`IDispEventImpl::GetTypeInfo`](#gettypeinfo)|Retrieves the type information for an object.|
71+
|[`IDispEventImpl::GetTypeInfoCount`](#gettypeinfocount)|Retrieves the number of type information interfaces.|
72+
|[`IDispEventImpl::GetUserDefinedType`](#getuserdefinedtype)|Retrieves the basic type of a user-defined type.|
7473
7574
## Remarks
7675
7776
`IDispEventImpl` provides a way of implementing an event dispinterface without requiring you to supply implementation code for every method/event on that interface. `IDispEventImpl` provides implementations of the `IDispatch` methods. You only need to supply implementations for the events that you are interested in handling.
7877
7978
`IDispEventImpl` works in conjunction with the event sink map in your class to route events to the appropriate handler function. To use this class:
8079
81-
Add a [SINK_ENTRY](composite-control-macros.md#sink_entry) or [SINK_ENTRY_EX](composite-control-macros.md#sink_entry_ex) macro to the event sink map for each event on each object that you want to handle. When using `IDispEventImpl` as a base class of a composite control, you can call [AtlAdviseSinkMap](connection-point-global-functions.md#atladvisesinkmap) to establish and break the connection with the event sources for all entries in the event sink map. In other cases, or for greater control, call [DispEventAdvise](idispeventsimpleimpl-class.md#dispeventadvise) to establish the connection between the source object and the base class. Call [DispEventUnadvise](idispeventsimpleimpl-class.md#dispeventunadvise) to break the connection.
80+
Add a [`SINK_ENTRY`](composite-control-macros.md#sink_entry) or [`SINK_ENTRY_EX`](composite-control-macros.md#sink_entry_ex) macro to the event sink map for each event on each object that you want to handle. When using `IDispEventImpl` as a base class of a composite control, you can call [`AtlAdviseSinkMap`](connection-point-global-functions.md#atladvisesinkmap) to establish and break the connection with the event sources for all entries in the event sink map. In other cases, or for greater control, call [`DispEventAdvise`](idispeventsimpleimpl-class.md#dispeventadvise) to establish the connection between the source object and the base class. Call [`DispEventUnadvise`](idispeventsimpleimpl-class.md#dispeventunadvise) to break the connection.
8281
83-
You must derive from `IDispEventImpl` (using a unique value for *nID*) for each object for which you need to handle events. You can reuse the base class by unadvising against one source object then advising against a different source object, but the maximum number of source objects that can be handled by a single object at one time is limited by the number of `IDispEventImpl` base classes.
82+
You must derive from `IDispEventImpl` (using a unique value for *`nID`*) for each object for which you need to handle events. You can reuse the base class by unadvising against one source object then advising against a different source object, but the maximum number of source objects that can be handled by a single object at one time is limited by the number of `IDispEventImpl` base classes.
8483
85-
`IDispEventImpl` provides the same functionality as [IDispEventSimpleImpl](../../atl/reference/idispeventsimpleimpl-class.md), except it gets type information about the interface from a type library rather than having it supplied as a pointer to an [_ATL_FUNC_INFO](../../atl/reference/atl-func-info-structure.md) structure. Use `IDispEventSimpleImpl` when you do not have a type library describing the event interface or want to avoid the overhead associated with using the type library.
84+
`IDispEventImpl` provides the same functionality as [`IDispEventSimpleImpl`](idispeventsimpleimpl-class.md), except it gets type information about the interface from a type library rather than having it supplied as a pointer to an [`_ATL_FUNC_INFO`](atl-func-info-structure.md) structure. Use `IDispEventSimpleImpl` when you do not have a type library describing the event interface or want to avoid the overhead associated with using the type library.
8685
8786
> [!NOTE]
8887
> `IDispEventImpl` and `IDispEventSimpleImpl` provide their own implementation of `IUnknown::QueryInterface` enabling each `IDispEventImpl` and `IDispEventSimpleImpl` base class to act as a separate COM identity while still allowing direct access to class members in your main COM object.
8988
90-
CE ATL implementation of ActiveX event sinks only supports return values of type HRESULT or void from your event handler methods; any other return value is unsupported and its behavior is undefined.
89+
CE ATL implementation of ActiveX event sinks only supports return values of type `HRESULT` or `void` from your event handler methods; any other return value is unsupported and its behavior is undefined.
9190
92-
For more information, see [Supporting IDispEventImpl](../../atl/supporting-idispeventimpl.md).
91+
For more information, see [Supporting `IDispEventImpl`](../supporting-idispeventimpl.md).
9392
9493
## Inheritance Hierarchy
9594
9695
`_IDispEvent`
9796
9897
`_IDispEventLocator`
9998
100-
[IDispEventSimpleImpl](../../atl/reference/idispeventsimpleimpl-class.md)
99+
[`IDispEventSimpleImpl`](idispeventsimpleimpl-class.md)
101100
102101
`IDispEventImpl`
103102
104103
## Requirements
105104
106-
**Header:** atlcom.h
105+
**Header:** `atlcom.h`
107106
108-
## <a name="getfuncinfofromid"></a> IDispEventImpl::GetFuncInfoFromId
107+
## <a name="getfuncinfofromid"></a> `IDispEventImpl::GetFuncInfoFromId`
109108
110109
Locates the function index for the specified dispatch identifier.
111110
112-
```
111+
```cpp
113112
HRESULT GetFuncInfoFromId(
114113
const IID& iid,
115114
DISPID dispidMember,
@@ -119,27 +118,27 @@ HRESULT GetFuncInfoFromId(
119118

120119
### Parameters
121120

122-
*iid*<br/>
121+
*`iid`*\
123122
[in] A reference to the ID of the function.
124123

125-
*dispidMember*<br/>
124+
*`dispidMember`*\
126125
[in] The dispatch ID of the function.
127126

128-
*lcid*<br/>
127+
*`lcid`*\
129128
[in] The locale context of the function ID.
130129

131-
*info*<br/>
130+
*`info`*\
132131
[in] The structure indicating how the function is called.
133132

134133
### Return Value
135134

136-
A standard HRESULT value.
135+
A standard `HRESULT` value.
137136

138-
## <a name="getidsofnames"></a> IDispEventImpl::GetIDsOfNames
137+
## <a name="getidsofnames"></a> `IDispEventImpl::GetIDsOfNames`
139138

140-
Maps a single member and an optional set of argument names to a corresponding set of integer DISPIDs, which can be used on subsequent calls to [IDispatch::Invoke](/windows/win32/api/oaidl/nf-oaidl-idispatch-invoke).
139+
Maps a single member and an optional set of argument names to a corresponding set of integer `DISPID`s, which can be used on subsequent calls to [`IDispatch::Invoke`](/windows/win32/api/oaidl/nf-oaidl-idispatch-invoke).
141140

142-
```
141+
```cpp
143142
STDMETHOD(GetIDsOfNames)(
144143
REFIID riid,
145144
LPOLESTR* rgszNames,
@@ -150,49 +149,47 @@ STDMETHOD(GetIDsOfNames)(
150149
151150
### Remarks
152151
153-
See [IDispatch::GetIDsOfNames](/windows/win32/api/oaidl/nf-oaidl-idispatch-getidsofnames) in the Windows SDK.
152+
See [`IDispatch::GetIDsOfNames`](/windows/win32/api/oaidl/nf-oaidl-idispatch-getidsofnames) in the Windows SDK.
154153
155-
## <a name="gettypeinfo"></a> IDispEventImpl::GetTypeInfo
154+
## <a name="gettypeinfo"></a> `IDispEventImpl::GetTypeInfo`
156155
157156
Retrieves the type information for an object, which can then be used to get the type information for an interface.
158157
159-
```
158+
```cpp
160159
STDMETHOD(GetTypeInfo)(
161160
UINT itinfo,
162161
LCID lcid,
163162
ITypeInfo** pptinfo);
164163
```
165164

166-
### Remarks
167-
168-
## <a name="gettypeinfocount"></a> IDispEventImpl::GetTypeInfoCount
165+
## <a name="gettypeinfocount"></a> `IDispEventImpl::GetTypeInfoCount`
169166

170167
Retrieves the number of type information interfaces that an object provides (either 0 or 1).
171168

172-
```
169+
```cpp
173170
STDMETHOD(GetTypeInfoCount)(UINT* pctinfo);
174171
```
175172
176173
### Remarks
177174
178-
See [IDispatch::GetTypeInfoCount](/windows/win32/api/oaidl/nf-oaidl-idispatch-gettypeinfocount) in the Windows SDK.
175+
See [`IDispatch::GetTypeInfoCount`](/windows/win32/api/oaidl/nf-oaidl-idispatch-gettypeinfocount) in the Windows SDK.
179176
180-
## <a name="getuserdefinedtype"></a> IDispEventImpl::GetUserDefinedType
177+
## <a name="getuserdefinedtype"></a> `IDispEventImpl::GetUserDefinedType`
181178
182179
Retrieves the basic type of a user-defined type.
183180
184-
```
181+
```cpp
185182
VARTYPE GetUserDefinedType(
186183
ITypeInfo* pTI,
187184
HREFTYPE hrt);
188185
```
189186

190187
### Parameters
191188

192-
*pTI*<br/>
193-
[in] A pointer to the [ITypeInfo](/windows/win32/api/oaidl/nn-oaidl-itypeinfo) interface containing the user-defined type.
189+
*`pTI`*\
190+
[in] A pointer to the [`ITypeInfo`](/windows/win32/api/oaidl/nn-oaidl-itypeinfo) interface containing the user-defined type.
194191

195-
*hrt*<br/>
192+
*`hrt`*\
196193
[in] A handle to the type description to be retrieved.
197194

198195
### Return Value
@@ -201,21 +198,21 @@ The type of variant.
201198

202199
### Remarks
203200

204-
See [ITypeInfo::GetRefTypeInfo](/windows/win32/api/oaidl/nf-oaidl-itypeinfo-getreftypeinfo).
201+
See [`ITypeInfo::GetRefTypeInfo`](/windows/win32/api/oaidl/nf-oaidl-itypeinfo-getreftypeinfo).
205202

206-
## <a name="idispeventimpl"></a> IDispEventImpl::IDispEventImpl
203+
## <a name="idispeventimpl"></a> `IDispEventImpl::IDispEventImpl`
207204

208-
The constructor. Stores the values of the class template parameters *plibid*, *pdiid*, *wMajor*, and *wMinor*.
205+
The constructor. Stores the values of the class template parameters *`plibid`*, *`pdiid`*, *`wMajor`*, and *`wMinor`*.
209206

210-
```
207+
```cpp
211208
IDispEventImpl();
212209
```
213210

214-
## <a name="tihclass"></a> IDispEventImpl::tihclass
211+
## <a name="_tihclass"></a> `IDispEventImpl::_tihclass`
215212

216-
This typedef is an instance of the class template parameter *tihclass*.
213+
This typedef is an instance of the class template parameter *`tihclass`*.
217214

218-
```
215+
```cpp
219216
typedef tihclass _tihclass;
220217
```
221218

@@ -225,10 +222,10 @@ By default, the class is `CComTypeInfoHolder`. `CComTypeInfoHolder` manages the
225222

226223
## See also
227224

228-
[_ATL_FUNC_INFO Structure](../../atl/reference/atl-func-info-structure.md)<br/>
229-
[IDispatchImpl Class](../../atl/reference/idispatchimpl-class.md)<br/>
230-
[IDispEventSimpleImpl Class](../../atl/reference/idispeventsimpleimpl-class.md)<br/>
231-
[SINK_ENTRY](composite-control-macros.md#sink_entry)<br/>
232-
[SINK_ENTRY_EX](composite-control-macros.md#sink_entry_ex)<br/>
233-
[SINK_ENTRY_INFO](composite-control-macros.md#sink_entry_info)<br/>
234-
[Class Overview](../../atl/atl-class-overview.md)
225+
[`_ATL_FUNC_INFO` Structure](atl-func-info-structure.md)\
226+
[`IDispatchImpl` Class](idispatchimpl-class.md)\
227+
[`IDispEventSimpleImpl` Class](idispeventsimpleimpl-class.md)\
228+
[`SINK_ENTRY`](composite-control-macros.md#sink_entry)\
229+
[`SINK_ENTRY_EX`](composite-control-macros.md#sink_entry_ex)\
230+
[`SINK_ENTRY_INFO`](composite-control-macros.md#sink_entry_info)\
231+
[Class Overview](../atl-class-overview.md)

0 commit comments

Comments
 (0)