Map Event Source with Event Sink

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

With the event source and sink specified, an MFC Application must declare an event sink map that selects specific event handlers from the event sink. The event sink map works with IDispEventSimpleImpl to route appropriate events to the mapped event handlers. For our CSampleUccEndpoint class to handle all the events defined in _IUccEndpointEvents and _IUccSessionManagerEvents, the declaration of the event sink map is as follows.

#pragma once
#include "stdafx.h"
extern _ATL_FUNC_INFO FUNC_INFO_I4_UNKNOWN_UNKNOWN;

class CSampleUccEndPoint :
    public IDispEventSimpleImpl<1, CSampleUccEndPoint, &DIID__IUccEndpointEvents>,
    public IDispEventSimpleImpl<1, CSampleUccEndPoint, &DIID__IUccSessionManagerEvents>
{
public:
    BEGIN_SINK_MAP(CSampleUccEndPoint)
        SINK_ENTRY_INFO(1, DIID__IUccEndpointEvents, DISPID_EE_ONENABLE, OnEnable, &FUNC_INFO_I4_UNKNOWN_UNKNOWN )
        SINK_ENTRY_INFO(1, DIID__IUccEndpointEvents, DISPID_EE_ONDISABLE, OnDisable, &FUNC_INFO_I4_UNKNOWN_UNKNOWN )
        SINK_ENTRY_INFO(1, DIID__IUccSessionManagerEvents, DISPID_SME_ONINCOMINGSESSION, OnIncomingSession, &FUNC_INFO_I4_UNKNOWN_UNKNOWN )
        
    END_SINK_MAP()

    CComPtr<IUccEndpoint> m_spIUccEndpoint;
    CComPrt<IUccPlatform> m_spIUccPlatform;
    // Other class declaration goes here.
}

The declaration of an event sink map consists of a list of SINK_ENTRY_INFO macros. The map begins with the BEGIN_SINK_MAP(class T) macro and ends with the END_SINK_MAP() macro. Each SINK_ETNRY_INFO specifies a member (as identified by both the identifier, for example, DISPID_EE_ONENABLE and the name, for example, OnEnable of the member) of the dispinterface (identified by the interface identifier, for example, DIID__IUccEndpointEvents).

An event sink map is also typically declared in the class header file.

See Also

Concepts

Catching Unified Communications Client API Events Using ATL Templates
Declare Event Source and Event Sink
Connect Event Source and Event Sink
Implement an Event Handler