Skip to content

Repo sync for protected CLA branch #4668

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 26 commits into from
Aug 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
d3b6e49
draft
Jul 5, 2023
2a92759
Merge branch 'main' of https://github.com/MicrosoftDocs/cpp-docs-pr i…
Jul 10, 2023
8a080c3
draft
Jul 11, 2023
fa7aa7f
draft
Jul 12, 2023
042bf25
Merge branch 'main' of https://github.com/MicrosoftDocs/cpp-docs-pr i…
Jul 12, 2023
d2c967f
draft
Jul 12, 2023
d1a5594
finish draft
Jul 13, 2023
943e93a
draft
Jul 24, 2023
a80e543
Merge branch 'main' of https://github.com/MicrosoftDocs/cpp-docs-pr i…
Jul 26, 2023
b6b3b7c
add another example
Jul 27, 2023
e1129f2
tuning
Jul 27, 2023
6f53222
Learn Editor: Update connection-maps.md
dmitrykobets-msft Jul 28, 2023
2c0f5a6
Learn Editor: Update connection-maps.md
dmitrykobets-msft Jul 28, 2023
964974a
Learn Editor: Update connection-maps.md
dmitrykobets-msft Jul 28, 2023
0ec0e34
add description for using heap after free in the doublefree example
Jul 28, 2023
a074d81
Merge branch 'main' of https://github.com/MicrosoftDocs/cpp-docs-pr i…
Jul 28, 2023
d117248
wordsmith
Jul 28, 2023
2c4d048
wordsmith
Jul 28, 2023
3bd13df
adjust formatting of code
Jul 28, 2023
1a6b8e6
another try at the formatting
Jul 28, 2023
32bc0fe
Fix acrolinx and formatting
dmitrykobets-msft Jul 31, 2023
46d6830
Merge pull request #4999 from dmitrykobets-msft/docs-editor/connectio…
prmerger-automator[bot] Jul 31, 2023
a839a24
quick edit pass
Jul 31, 2023
cbdb87e
Merge pull request #4979 from TylerMSFT/asan-coe
denrea Jul 31, 2023
12d0104
Merge pull request #5002 from MicrosoftDocs/main
PhilKang0704 Aug 1, 2023
bdd563c
Merging changes synced from https://github.com/MicrosoftDocs/cpp-docs…
Aug 1, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 17 additions & 7 deletions docs/mfc/reference/connection-maps.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ ms.date: "11/04/2016"
helpviewer_keywords: ["connection maps"]
ms.assetid: 1f25a9bc-6d09-4614-99cf-dc38e8ddfa73
---

# Connection Maps

OLE controls are able to expose interfaces to other applications. These interfaces only allow access from a container into that control. If an OLE control wants to access external interfaces of other OLE objects, a connection point must be established. This connection point allows a control outgoing access to external dispatch maps, such as event maps or notification functions.

The Microsoft Foundation Class Library offers a programming model that supports connection points. In this model, "connection maps" are used to designate interfaces or connection points for the OLE control. Connection maps contain one macro for each connection point. For more information on connection maps, see the [CConnectionPoint](../../mfc/reference/cconnectionpoint-class.md) class.

Typically, a control will support just two connection points: one for events and one for property notifications. These are implemented by the `COleControl` base class and require no additional work by the control writer. Any additional connection points you want to implement in your class must be added manually. To support connection maps and points, MFC provides the following macros:
Typically, a control supports just two connection points: one for events and one for property notifications. These are implemented by the `COleControl` base class and require no extra work by the control writer. Any other connection points you want to implement in your class must be added manually. To support connection maps and points, MFC provides the following macros:

### Connection Map Declaration and Demarcation

Expand Down Expand Up @@ -52,7 +53,7 @@ Specifies the name of the local class that implements the connection point.

### Remarks

In the declaration (.h) file that defines the member functions for your class, start the connection point with the BEGIN_CONNECTION_PART macro, then add the CONNECTION_IID macro and any other member functions you wish to implement, and complete the connection point map with the END_CONNECTION_PART macro.
In the declaration (.h) file that defines the member functions for your class, start the connection point with the BEGIN_CONNECTION_PART macro. Then add the CONNECTION_IID macro and any other member functions you wish to implement. Finally, complete the connection point map with the END_CONNECTION_PART macro.

### Requirements

Expand Down Expand Up @@ -90,7 +91,7 @@ The interface ID of the interface called by the connection point.

### Remarks

The *iid* argument is an interface ID used to identify the interface that the connection point will call on its connected sinks. For example:
The *iid* argument is an interface ID used to identify the interface that the connection point calls on its connected sinks. For example:

[!code-cpp[NVC_MFCConnectionPoints#10](../../mfc/codesnippet/cpp/connection-maps_1.h)]

Expand Down Expand Up @@ -177,7 +178,7 @@ For example:

[!code-cpp[NVC_MFCConnectionPoints#2](../../mfc/codesnippet/cpp/connection-maps_2.cpp)]

implements a connection map, with a connection point, that calls the `IID_ISinkInterface` interface .
implements a connection map, with a connection point, that calls the `IID_ISinkInterface` interface.

### Requirements

Expand Down Expand Up @@ -208,9 +209,13 @@ A pointer to the object that implements the interface.
The interface ID of the connection.

*bRefCount*<br/>
TRUE indicates that creating the connection should cause the reference count of *pUnkSink* to be incremented. FALSE indicates that the reference count should not be incremented.
For out-of-process connections, this parameter must be TRUE, and indicates that creating the connection should cause the reference count of *pUnkSink* to be incremented.

For in-process connections, TRUE indicates that creating the connection should cause the reference count of *pUnkSink* to be incremented. FALSE indicates that the reference count should not be incremented.

**Warning**: In general, it can't be predicted which connections are in-process and which connections are out-of-process, so it is recommended to always set this parameter to TRUE.

*pdwCookie*<br/>
*pdwCookie.*<br/>
A pointer to a DWORD where a connection identifier is returned. This value should be passed as the *dwCookie* parameter to `AfxConnectionUnadvise` when disconnecting the connection.

### Return Value
Expand Down Expand Up @@ -250,7 +255,11 @@ A pointer to the object that implements the interface.
The interface ID of the connection point interface.

*bRefCount*<br/>
TRUE indicates that disconnecting the connection should cause the reference count of *pUnkSink* to be decremented. FALSE indicates that the reference count should not be decremented.
For out-of-process connections, this parameter must be TRUE, and indicates that creating the connection should cause the reference count of *pUnkSink* to be decremented.

For in-process connections, TRUE indicates that creating the connection should cause the reference count of *pUnkSink* to be decremented. FALSE indicates that the reference count should not be decremented.

**Warning**: In general, it cannot be predicted which connections are in-process and which connections are out-of-process, so it is recommended to always set this parameter to TRUE.

*dwCookie*<br/>
The connection identifier returned by `AfxConnectionAdvise`.
Expand All @@ -270,3 +279,4 @@ Nonzero if a connection was disconnected; otherwise 0.
## See also

[Macros and Globals](../../mfc/reference/mfc-macros-and-globals.md)

Loading