共用方式為


Connection Point Macros

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The latest version of this topic can be found at Connection Point Macros.

These macros define connection point maps and entries.

BEGIN_CONNECTION_POINT_MAP Marks the beginning of the connection point map entries.
CONNECTION_POINT_ENTRY Enters connection points into the map.
END_CONNECTION_POINT_MAP Marks the end of the connection point map entries.

BEGIN_CONNECTION_POINT_MAP

Marks the beginning of the connection point map entries.

BEGIN_CONNECTION_POINT_MAP
(x)

Parameters

x
[in] The name of the class containing the connection points.

Remarks

Start your connection point map with the BEGIN_CONNECTION_POINT_MAP macro, add entries for each of your connection points with the CONNECTION_POINT_ENTRY macro, and complete the map with the END_CONNECTION_POINT_MAP macro.

For more information about connection points in ATL, see the article Connection Points.

Example

BEGIN_CONNECTION_POINT_MAP(CPolyCtl)
   CONNECTION_POINT_ENTRY(__uuidof(_IPolyCtlEvents))
END_CONNECTION_POINT_MAP()

CONNECTION_POINT_ENTRY

Enters a connection point for the specified interface into the connection point map so that it can be accessed.

CONNECTION_POINT_ENTRY
(iid)

Parameters

iid
[in] The GUID of the interface being added to the connection point map.

Remarks

Connection point entries in the map are used by IConnectionPointContainerImpl. The class containing the connection point map must inherit from IConnectionPointContainerImpl.

Start your connection point map with the BEGIN_CONNECTION_POINT_MAP macro, add entries for each of your connection points with the CONNECTION_POINT_ENTRY macro, and complete the map with the END_CONNECTION_POINT_MAP macro.

For more information about connection points in ATL, see the article Connection Points.

Example

class ATL_NO_VTABLE CConnect2 :
   public CComObjectRootEx<CComSingleThreadModel>,
   public CComCoClass<CConnect2, &CLSID_Connect2>,
   public IConnectionPointContainerImpl<CConnect2>,
   public IPropertyNotifySinkCP<CConnect2>
{
public:
   BEGIN_CONNECTION_POINT_MAP(CConnect2)
      CONNECTION_POINT_ENTRY(IID_IPropertyNotifySink)
   END_CONNECTION_POINT_MAP()

   // Remainder of class declaration omitted.

END_CONNECTION_POINT_MAP

Marks the end of the connection point map entries.

END_CONNECTION_POINT_MAP
()

Remarks

Start your connection point map with the BEGIN_CONNECTION_POINT_MAP macro, add entries for each of your connection points with the CONNECTION_POINT_ENTRY macro, and complete the map with the END_CONNECTION_POINT_MAP macro.

For more information about connection points in ATL, see the article Connection Points.

Example

BEGIN_CONNECTION_POINT_MAP(CMyComponent)
   CONNECTION_POINT_ENTRY(__uuidof(_IMyComponentEvents))
END_CONNECTION_POINT_MAP()

See Also

Macros
Connection Point Global Functions