Skip to content

Commit bccada9

Browse files
authored
Update adding-connection-points-to-an-object.md
Since the file is open, fixed some other things that bugged me.
1 parent b805aad commit bccada9

File tree

1 file changed

+15
-18
lines changed

1 file changed

+15
-18
lines changed

docs/atl/adding-connection-points-to-an-object.md

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -6,50 +6,47 @@ helpviewer_keywords: ["connection points [C++], adding to ATL objects", "Impleme
66
---
77
# Adding Connection Points to an Object
88

9-
The [ATL Tutorial](active-template-library-atl-tutorial.md) demonstrates how to create a control with support for connection points, how to add events, and then how to implement the connection point. ATL implements connection points with the [IConnectionPointImpl](reference/iconnectionpointimpl-class.md) class.
9+
The [ATL Tutorial](active-template-library-atl-tutorial.md) demonstrates how to create a control with support for connection points, how to add events, and then how to implement the connection point. ATL implements connection points with the [`IConnectionPointImpl`](reference/iconnectionpointimpl-class.md) class.
1010

1111
To implement a connection point, you have two choices:
1212

1313
- Implement your own outgoing event source, by adding a connection point to the control or object.
14-
1514
- Reuse a connection point interface defined in another type library.
1615

17-
In either case, the Implement Connection Point Wizard uses a type library to do its work.
16+
In either case, the **Implement Connection Point Wizard** uses a type library to do its work.
1817

19-
### To add a connection point to a control or object
18+
### Add a connection point to a control or object
2019

21-
1. Define a dispinterface in the library block of the .idl file. If you enabled support for connection points when you created the control with the ATL Control Wizard, the dispinterface will already be created. If you did not enable support for connection points when you created the control, you must manually add a dispinterface to the .idl file. The following is an example of a dispinterface. Outgoing interfaces are not required to be dispatch interfaces but many scripting languages such as VBScript and JScript require this, so this example uses two dispinterfaces:
20+
1. Define a dispinterface in the library block of the `.idl` file. If you enabled support for connection points when you created the control with the **ATL Control Wizard**, the dispinterface will already be created. If you did not enable support for connection points when you created the control, you must manually add a dispinterface to the `.idl` file. The following is an example of a dispinterface. Outgoing interfaces are not required to be dispatch interfaces but many scripting languages such as VBScript and JScript require this, so this example uses two dispinterfaces:
2221

2322
[!code-cpp[NVC_ATL_Windowing#81](codesnippet/cpp/adding-connection-points-to-an-object_1.idl)]
2423

25-
Use either the uuidgen.exe or guidgen.exe utility to generate a GUID.
24+
Use either the `uuidgen.exe` or `guidgen.exe` utility to generate a GUID.
2625

27-
2. Add the dispinterface as the `[default,source]` interface in the coclass for the object in the project's .idl file. Again, if you enabled support for connection points when you created the control, the ATL Control Wizard will create the `[default,source]` entry. To manually add this entry, add the line in bold:
26+
2. Add the dispinterface as the `[default,source]` interface in the coclass for the object in the project's `.idl` file. Again, if you enabled support for connection points when you created the control, the ATL Control Wizard will create the `[default,source]` entry. To manually add this entry, add the line in bold:
2827

2928
[!code-cpp[NVC_ATL_Windowing#82](codesnippet/cpp/adding-connection-points-to-an-object_2.idl)]
3029

31-
See the .idl file in the [Circ](../overview/visual-cpp-samples.md) ATL sample for an example.
30+
See the `.idl` file in the [Circ](../overview/visual-cpp-samples.md) ATL sample for an example.
3231

33-
3. Use Class View to add methods and properties to the event interface. Right-click the class in Class View, point to **Add** on the shortcut menu, and click **Add Connection Point**.
32+
3. Use **Class View** to add methods and properties to the event interface. Right-click the class in **Class View**, point to **Add** on the shortcut menu, and click **Add Connection Point**.
3433

35-
4. In the **Source Interfaces** list box of the Implement Connection Point Wizard, select **Project's interfaces**. If you choose an interface for your control and press **OK**, you will:
34+
4. In the **Source Interfaces** list box of the **Implement Connection Point Wizard**, select **Project's interfaces**. If you choose an interface for your control and select **OK**, you:
3635

3736
- Generate a header file with an event proxy class that implements the code that will make the outgoing calls for the event.
38-
3937
- Add an entry to the connection point map.
4038

41-
You will also see a list of all of the type libraries on your computer. You should only use one of these other type libraries to define your connection point if you want to implement the exact same outgoing interface found in another type library.
42-
43-
### To reuse a connection point interface defined in another type library
39+
You also see a list of all of the type libraries on your computer. Only use one of these other type libraries to define your connection point if you want to implement the exact same outgoing interface found in another type library.
4440

45-
1. In Class View, right-click a class that implements a **BEGIN_COM_MAP** macro, point to **Add** on the shortcut menu, and click **Add Connection Point**.
41+
### Reuse a connection point interface defined in another type library
4642

47-
2. In the Implement Connection Point Wizard, select a type library and an interface in the type library and click **Add**.
43+
1. In **Class View**, right-click a class that implements a `BEGIN_COM_MAP` macro, point at **Add** on the shortcut menu, and select **Add Connection Point**.
4844

49-
3. Edit the .idl file to either:
45+
2. In the **Implement Connection Point Wizard**, select a type library and an interface in the type library and select **Add**.
5046

51-
- Copy the dispinterface from the .idl file for the object whose event-source is being used.
47+
3. Edit the `.idl` file to either:
5248

49+
- Copy the dispinterface from the `.idl` file for the object whose event-source is being used.
5350
- Use the **importlib** instruction on that type library.
5451

5552
## See also

0 commit comments

Comments
 (0)