IDirectPlay2::EnumPlayers

HRESULT EnumPlayers(LPGUID lpguidInstance,

LPDPENUMPLAYERSCALLBACK2 lpEnumPlayersCallback2,

LPVOID lpContext, DWORD dwFlags);

Enumerates the players in a session.

·Returns DP_OK if successful, or one of the following error values otherwise:

DPERR_EXCEPTION

DPERR_GENERIC

DPERR_INVALIDOBJECT

DPERR_UNSUPPORTED

lpguidInstance

DirectPlay session instance of interest. This parameter must be set to NULL unless the DPENUMPLAYERS_SESSION flag is specified.

lpEnumPlayersCallback2

Address of the EnumPlayersCallback2 function that will be called for every group in the session.

lpContext

Address of an application-defined context that is passed to each enumeration callback.

dwFlags

Flags to be passed in the dwFlags parameter to the callback function.

DPENUMPLAYERS_GROUP

Includes groups in the enumeration of players.

DPENUMPLAYERS_LOCAL

Enumerates only those players that were created locally by this DirectPlay object.

DPENUMPLAYERS_REMOTE

Enumerates only those players that were created by remote DirectPlay objects.

DPENUMPLAYERS_SESSION

Enumerates the players for the session identified by lpguidInstance.

By default, this method will enumerate players in the current open session. Groups can also be included in the enumeration by using the DPENUMPLAYERS_GROUP flag. The DPENUMPLAYERS_SESSION flag can be used, along with a session instance GUID, to request that a session's host provide its list for enumeration. This method cannot be called from within an IDirectPlay2::EnumSessions enumeration. Furthermore, use of the DPENUMPLAYERS_SESSION flag with this method must occur after the IDirectPlay2::EnumSessions method has been called, and before any calls to the IDirectPlay2::Close or IDirectPlay2::Open methods.