Implementing a Connection Point (Visual C++)


For the latest documentation on Visual Studio 2017 RC, see Visual Studio 2017 RC Documentation.

To implement a connection point using the Implement Connection Point Wizard, you must have created a project as an ATL COM application or as an MFC application that contains ATL support. You can use the ATL Project Wizard to create an ATL application, or add an ATL object to your MFC application to implement ATL support for an MFC application.

System_CAPS_ICON_note.jpg Note

For information about implementing connection points for an MFC project, see Connection Points.

Once you create the project, to implement a connection point, you must first add an ATL object. See Adding Objects and Controls to an ATL Project for a list of wizards that add objects to your ATL project.

System_CAPS_ICON_note.jpg Note

The wizard does not support ATL dialogs, XML Web services created with ATL Server, performance objects, or performance counters.

A connectable object (that is, a source) can expose a connection point for each of its outgoing interfaces. Each outgoing interface can be implemented by a client on an object (that is, a sink). For more information, see ATL Connection Points.

To implement a connection point

  1. In Class View, right-click the class name for your ATL object.

  2. Click Add from the shortcut menu, and then click Add Connection Point to display the Implement Connection Point Wizard.

  3. Select the connection point interfaces to implement from the appropriate type libraries and click Finish.

  4. In Class View, examine the proxy classes created for each connection point. The classes appear as CProxyInterfaceName<T> and are derived from IConnectionPointImpl.

  5. Double-click the connection point class to display the definition of the connection point's class.

    • If you implement a connection point for your own project's interface, the following definition appears

      template< class T >  
      class CProxyInterfaceName :  
         public IConnectionPointImpl< T, &IID_InterfaceName >  

      If you implement a local interface, methods and properties appear in the class body.

    • If you implement a connection point for another interface, the definition includes the interface's methods, each preceded by Fire_.

Adding Functionality with Code Wizards
Adding Connection Points to an Object