Szerkesztés

Megosztás a következőn keresztül:


Composite Control Macros

These macros define event sink maps and entries.

Macro Description
BEGIN_SINK_MAP Marks the beginning of the event sink map for the composite control.
END_SINK_MAP Marks the end of the event sink map for the composite control.
SINK_ENTRY Entry to the event sink map.
SINK_ENTRY_EX Entry to the event sink map with an extra parameter.
SINK_ENTRY_EX_P (Visual Studio 2017) Similar to SINK_ENTRY_EX except that it takes a pointer to iid.
SINK_ENTRY_INFO Entry to the event sink map with manually supplied type information for use with IDispEventSimpleImpl.
SINK_ENTRY_INFO_P (Visual Studio 2017) Similar to SINK_ENTRY_INFO except that it takes a pointer to iid.

Requirements

Header: atlcom.h

BEGIN_SINK_MAP

Declares the beginning of the event sink map for the composite control.

BEGIN_SINK_MAP(_class)

Parameters

_class
[in] Specifies the control.

Example

BEGIN_SINK_MAP(CMyCompositeCtrl)
   //Make sure the Event Handlers have __stdcall calling convention
   SINK_ENTRY(IDC_CALENDAR1, DISPID_CLICK, &CMyCompositeCtrl::ClickCalendar1)
   SINK_ENTRY(IDC_CALENDAR2, DISPID_CLICK, &CMyCompositeCtrl::ClickCalendar2)
END_SINK_MAP()

Remarks

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.

END_SINK_MAP

Declares the end of the event sink map for the composite control.

END_SINK_MAP()

Example

BEGIN_SINK_MAP(CMyCompositeCtrl)
   //Make sure the Event Handlers have __stdcall calling convention
   SINK_ENTRY(IDC_CALENDAR1, DISPID_CLICK, &CMyCompositeCtrl::ClickCalendar1)
   SINK_ENTRY(IDC_CALENDAR2, DISPID_CLICK, &CMyCompositeCtrl::ClickCalendar2)
END_SINK_MAP()

Remarks

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.

SINK_ENTRY

Declares the handler function (fn) for the specified event (dispid), of the control identified by id.

SINK_ENTRY( id, dispid, fn )

Parameters

id
[in] Identifies the control.

dispid
[in] Identifies the specified event.

fn
[in] Name of the event handler function. This function must use the _stdcall calling convention and have the appropriate dispinterface-style signature.

Example

BEGIN_SINK_MAP(CMyCompositeCtrl)
   //Make sure the Event Handlers have __stdcall calling convention
   SINK_ENTRY(IDC_CALENDAR1, DISPID_CLICK, &CMyCompositeCtrl::ClickCalendar1)
   SINK_ENTRY(IDC_CALENDAR2, DISPID_CLICK, &CMyCompositeCtrl::ClickCalendar2)
END_SINK_MAP()

Remarks

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.

SINK_ENTRY_EX and SINK_ENTRY_EX_P

Declares the handler function (fn) for the specified event (dispid), of the dispatch interface (iid), for the control identified by id.

SINK_ENTRY_EX( id, iid, dispid, fn )
SINK_ENTRY_EX_P( id, piid, dispid, fn ) // (Visual Studio 2017)

Parameters

id
[in] Identifies the control.

iid
[in] Identifies the dispatch interface.

piid
[in] Pointer to the dispatch interface.

dispid
[in] Identifies the specified event.

fn
[in] Name of the event handler function. This function must use the _stdcall calling convention and have the appropriate dispinterface-style signature.

Example

BEGIN_SINK_MAP(CMyCompositCtrl2)
   //Make sure the Event Handlers have __stdcall calling convention
   SINK_ENTRY_EX(IDC_CALENDAR1, __uuidof(DCalendarEvents), DISPID_CLICK, 
      &CMyCompositCtrl2::ClickCalendar1)
   SINK_ENTRY_EX(IDC_CALENDAR2, __uuidof(DCalendarEvents), DISPID_CLICK, 
      &CMyCompositCtrl2::ClickCalendar2)
END_SINK_MAP()

Remarks

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.

SINK_ENTRY_INFO and SINK_ENTRY_INFO_P

Use the SINK_ENTRY_INFO macro within an event sink map to provide the information needed by IDispEventSimpleImpl to route events to the relevant handler function.

SINK_ENTRY_INFO( id, iid, dispid, fn, info )
SINK_ENTRY_INFO_P( id, piid, dispid, fn, info ) // (Visual Studio 2017)

Parameters

id
[in] Unsigned integer identifying the event source. This value must match the nID template parameter used in the related IDispEventSimpleImpl base class.

iid
[in] IID that identifies the dispatch interface.

piid
[in] Pointer to IID that identifies the dispatch interface.

dispid
[in] DISPID identifying the specified event.

fn
[in] Name of the event handler function. This function must use the _stdcall calling convention and have the appropriate dispinterface-style signature.

info
[in] Type information for the event handler function. This type information is provided in the form of a pointer to an _ATL_FUNC_INFO structure. CC_CDECL is the only option supported in Windows CE for the CALLCONV field of the _ATL_FUNC_INFO structure. Any other value is unsupported thus its behavior undefined.

Remarks

The first four macro parameters are the same as the ones for the SINK_ENTRY_EX macro. The final parameter provides type information for the event. 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.

See also

Macros
Composite Control Global Functions