Skip to content

Latest commit

 

History

History
130 lines (85 loc) · 3.51 KB

connection-point-global-functions.md

File metadata and controls

130 lines (85 loc) · 3.51 KB
description title ms.date f1_keywords helpviewer_keywords ms.assetid
Learn more about: Connection Point Global Functions
Connection Point Global Functions
11/04/2016
atlbase/ATL::AtlAdvise
atlbase/ATL::AtlUnadvise
atlbase/ATL::AtlAdviseSinkMap
connection points [C++], global functions
bcb4bf50-2155-4e20-b8bb-f2908b03a6e7

Connection Point Global Functions

These functions provide support for connection points and sink maps.

Important

The functions listed in the following table cannot be used in applications that execute in the Windows Runtime.

Function Description
AtlAdvise Creates a connection between an object's connection point and a client's sink.
AtlUnadvise Terminates the connection established through AtlAdvise.
AtlAdviseSinkMap Advises or unadvises entries in an event sink map.

Requirements

Header: atlbase.h

AtlAdvise

Creates a connection between an object's connection point and a client's sink.

Important

This function cannot be used in applications that execute in the Windows Runtime.

HRESULT    AtlAdvise(
    IUnknown* pUnkCP,
    IUnknown* pUnk,
    const IID& iid,
    LPDWORD pdw);

Parameters

pUnkCP
[in] A pointer to the IUnknown of the object the client wants to connect with.

pUnk
[in] A pointer to the client's IUnknown.

iid
[in] The GUID of the connection point. Typically, this is the same as the outgoing interface managed by the connection point.

pdw
[out] A pointer to the cookie that uniquely identifies the connection.

Return Value

A standard HRESULT value.

Remarks

The sink implements the outgoing interface supported by the connection point. The client uses the pdw cookie to remove the connection by passing it to AtlUnadvise.

Example

[!code-cppNVC_ATL_Windowing#91]

AtlUnadvise

Terminates the connection established through AtlAdvise.

Important

This function cannot be used in applications that execute in the Windows Runtime.

HRESULT    AtlUnadvise(
    IUnknown* pUnkCP,
    const IID& iid,
    DWORD dw);

Parameters

pUnkCP
[in] A pointer to the IUnknown of the object that the client is connected with.

iid
[in] The GUID of the connection point. Typically, this is the same as the outgoing interface managed by the connection point.

dw
[in] The cookie that uniquely identifies the connection.

Return Value

A standard HRESULT value.

Example

[!code-cppNVC_ATL_Windowing#96]

AtlAdviseSinkMap

Call this function to advise or unadvise all entries in the object's sink event map.

Important

This function cannot be used in applications that execute in the Windows Runtime.

HRESULT AtlAdviseSinkMap(T* pT, bool bAdvise);

Parameters

pT
[in] A pointer to the object containing the sink map.

bAdvise
[in] TRUE if all sink entries are to be advised; FALSE if all sink entries are to be unadvised.

Return Value

A standard HRESULT value.

Example

[!code-cppNVC_ATL_Windowing#92]

See also

Functions
Connection Point Macros