You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/mfc/reference/connection-maps.md
+17-7Lines changed: 17 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -5,13 +5,14 @@ ms.date: "11/04/2016"
5
5
helpviewer_keywords: ["connection maps"]
6
6
ms.assetid: 1f25a9bc-6d09-4614-99cf-dc38e8ddfa73
7
7
---
8
+
8
9
# Connection Maps
9
10
10
11
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.
11
12
12
13
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.
13
14
14
-
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:
15
+
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:
15
16
16
17
### Connection Map Declaration and Demarcation
17
18
@@ -52,7 +53,7 @@ Specifies the name of the local class that implements the connection point.
52
53
53
54
### Remarks
54
55
55
-
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.
56
+
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.
56
57
57
58
### Requirements
58
59
@@ -90,7 +91,7 @@ The interface ID of the interface called by the connection point.
90
91
91
92
### Remarks
92
93
93
-
The *iid* argument is an interface ID used to identify the interface that the connection point will call on its connected sinks. For example:
94
+
The *iid* argument is an interface ID used to identify the interface that the connection point calls on its connected sinks. For example:
implements a connection map, with a connection point, that calls the `IID_ISinkInterface` interface.
181
+
implements a connection map, with a connection point, that calls the `IID_ISinkInterface` interface.
181
182
182
183
### Requirements
183
184
@@ -208,9 +209,13 @@ A pointer to the object that implements the interface.
208
209
The interface ID of the connection.
209
210
210
211
*bRefCount*<br/>
211
-
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.
212
+
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.
213
+
214
+
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.
215
+
216
+
**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.
212
217
213
-
*pdwCookie*<br/>
218
+
*pdwCookie.*<br/>
214
219
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.
215
220
216
221
### Return Value
@@ -250,7 +255,11 @@ A pointer to the object that implements the interface.
250
255
The interface ID of the connection point interface.
251
256
252
257
*bRefCount*<br/>
253
-
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.
258
+
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.
259
+
260
+
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.
261
+
262
+
**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.
254
263
255
264
*dwCookie*<br/>
256
265
The connection identifier returned by `AfxConnectionAdvise`.
@@ -270,3 +279,4 @@ Nonzero if a connection was disconnected; otherwise 0.
270
279
## See also
271
280
272
281
[Macros and Globals](../../mfc/reference/mfc-macros-and-globals.md)
0 commit comments