Partager via


IEnumConnections

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This interface enumerates the current connections for a connectable object. Connectable objects support the following features:

  • Outgoing interfaces, such as event sets
  • The ability to enumerate the IIDs of the outgoing interfaces
  • The ability to connect and disconnect sinks to the object for those outgoing IIDs
  • The ability to enumerate the connections that exist to a particular outgoing interface

When to Implement

To support connectable objects, you need to provide four related interfaces:

The IConnectionPointContainer interface indicates the existence of the outgoing interfaces.

It provides access to an enumerator subobject with the IEnumConnectionPoints interface. It also provides a connection point subobject with the IConnectionPoint interface.

The IConnectionPoint interface provides access to an enumerator subobject with the IEnumConnections interface.

To avoid circular reference counting problems, the connection point is a separate subobject.

Any individual connection point can support enumeration of its currently known connections through IConnectionPoint::EnumConnections.

The enumerator created by this method implements the interface IEnumConnections, which deals with the type CONNECTDATA. Each CONNECTDATA structure contains the IUnknown of a connected sink and the dwConnection that was returned by IConnectionPoint::Advise when that sink was connected.

When enumerating connections through IEnumConnections, the enumerator is responsible for calling AddRef through the pointer in each enumerated structure, and the caller is responsible to later call Release when those pointers are no longer needed.

When to Use

Use the IEnumConnectionPoints interface to enumerate all the supported connection points for each outgoing IID.

Methods in Vtable Order

IUnknown method Description

QueryInterface

Returns pointers to supported interfaces.

AddRef

Increments the reference count.

Release

Decrements the reference count.

Method Description

Clone

Creates another enumerator that contains the same enumeration state as the current one.

Next

Enumerates the next cConnections elements in the enumerator's list, returning them in rgpcd along with the actual number of enumerated elements in pcFetched.

Reset

Instructs the enumerator to position itself at the beginning of the list of elements.

Skip

Instructs the enumerator to skip the next cConnections elements in the enumeration so that the next call to IEnumConnections::Next will not return those elements.

Remarks

To determine whether the platform supports this interface, see Determining Supported COM APIs.

Requirements

Header ocidl.h, ocidl.idl
Library ole32.lib, uuid.lib
Windows Embedded CE Windows CE 3.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

IConnectionPoint
IConnectionPointContainer
IEnumConnectionPoints