Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

IDispEventSimpleImpl Class

This class provides implementations of the IDispatch methods, without getting type information from a type library.

Important note Important

This class and its members cannot be used in applications that execute in the Windows Runtime.

template < 
UINT nID, 
class T, 
const IID* pdiid 
> 
class ATL_NO_VTABLE IDispEventSimpleImpl : 
public _IDispEventLocator<nID, pdiid>
nID

A unique identifier for the source object. When IDispEventSimpleImpl 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.

T

The user's class, which is derived from IDispEventSimpleImpl.

pdiid

The pointer to the IID of the event dispinterface implemented by this class.

Name

Description

IDispEventSimpleImpl::Advise

Establishes a connection with the default event source.

IDispEventSimpleImpl::DispEventAdvise

Establishes a connection with the event source.

IDispEventSimpleImpl::DispEventUnadvise

Breaks the connection with the event source.

IDispEventSimpleImpl::GetIDsOfNames

Returns E_NOTIMPL.

IDispEventSimpleImpl::GetTypeInfo

Returns E_NOTIMPL.

IDispEventSimpleImpl::GetTypeInfoCount

Returns E_NOTIMPL.

IDispEventSimpleImpl::Invoke

Calls the event handlers listed in the event sink map.

IDispEventSimpleImpl::Unadvise

Breaks the connection with the default event source.

IDispEventSimpleImpl provides a way of implementing an event dispinterface without requiring you to supply implementation code for every method/event on that interface. IDispEventSimpleImpl provides implementations of the IDispatch methods. You only need to supply implementations for the events that you are interested in handling.

IDispEventSimpleImpl works in conjunction with the event sink map in your class to route events to the appropriate handler function. To use this class:

  • Add a SINK_ENTRY_INFO macro to the event sink map for each event on each object that you want to handle.

  • Supply type information for each event by passing a pointer to an _ATL_FUNC_INFO structure as a parameter to each entry. On the x86 platform, the _ATL_FUNC_INFO.cc value must be CC_CDECL with the callback function calling method of __stdcall.

  • Call DispEventAdvise to establish the connection between the source object and the base class.

  • Call DispEventUnadvise to break the connection.

You must derive from IDispEventSimpleImpl (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 IDispEventSimpleImpl base classes.

IDispEventSimplImpl provides the same functionality as IDispEventImpl, except it does not get type information about the interface from a type library. The wizards generate code based only on IDispEventImpl, but you can use IDispEventSimpleImpl by adding the code by hand. Use IDispEventSimpleImpl when you don't have a type library describing the event interface or want to avoid the overhead associated with using the type library.

Note Note

IDispEventImpl and IDispEventSimpleImpl provide their own implementation of IUnknown::QueryInterface enabling each IDispEventImpl or IDispEventSimpleImpl base class to act as a separate COM identity while still allowing direct access to class members in your main COM object.

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.

For more information, see Supporting IDispEventImpl.

_IDispEvent

_IDispEventLocator

IDispEventSimpleImpl

Header: atlcom.h

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.