IEnumConnectionPoints::Next

HRESULT IEnumConnectionPoints::Next([in] ULONG cConnections , [out, max_is(cConnections)] IConnectionPoint **rgpcn, [out] ULONG *pcFetched);

Enumerates the next cConnections elements in the enumerator's list, returning them in rgpcn along with the actual number of enumerated elements in pcFetched. The caller is responsible for calling IConnectionPoint::Release through each pointer returned in rgpcn.

Argument

Type

Description

cConnections

ULONG

[in] Specifies the number of IConnectionPoint * values to return in the array pointed to by rgpcn. This argument must be 1 if pcFetched is NULL.

rgpcn

IConnectionPoint **

[out] A pointer to a caller-allocated IConnectionPoint * array of size cConnections in which to return the enumerated connection points. The caller is responsible for calling IConnectionPoint::Release through each pointer enumerated into the array once this method returns successfully. If cConnections is greater than one the caller must also pass a non-NULL pointer passed to pcFetched to know how many pointers to release.

pcFetched

ULONG

[out] A pointer to the variable to receive the actual number of connection points enumerated in rgpcn. This argument can be NULL in which case the cConnections argument must be 1.


Return Value

Meaning

S_OK

The requested number of elements has been returned and *pcFetched (if non-NULL) is set to cConnections if.

S_FALSE

The enumerator returned fewer elements than cConnections because there were not that many elements left in the list. In this case, unused elements in rgpcn in the enumeration are not set to NULL and *pcFetched holds the number of valid entries, even if zero is returned.

E_POINTER

The address in rgpcn is not valid (such as NULL).

E_INVALIDARG

The value of cConnections is not 1 when pcFetched is NULL; or the value of cConnections is zero.

E_UNEXPECTED

An unknown error occurred.

E_OUTOFMEMORY

There is not enough memory to enumerate the elements.


Comments E_NOTIMPL is not allowed as a return value. If an error value is returned, no entries in the rgpcn array are valid on exit and require no release.