IDirectPlay::EnumPlayers

HRESULT EnumPlayers(DWORD dwSessionId,

LPDPENUMPLAYERSCALLBACK lpEnumPlayersCallback,

LPVOID lpContext, DWORD dwFlags);

Enumerates the players in a session. Groups can also be included in the enumeration by using the DPENUMPLAYERS_GROUP flag.

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

DPERR_EXCEPTION DPERR_GENERIC
DPERR_INVALIDOBJECT DPERR_UNSUPPORTED

dwSessionID

Session of interest. Not used unless the DPENUMPLAYERS_SESSION flag is specified.

lpEnumPlayersCallback

Address for the EnumPlayersCallback function that will be called for every player in the session.

lpContext

Address for a caller-defined context that is passed to each enumeration callback.

dwFlags

Specifies the control flags.

DPENUMPLAYERS_GROUP

Includes groups in the enumeration of players.

DPENUMPLAYERS_PREVIOUS

Enumerates players previously stored in the registry. Not yet supported.

DPENUMPLAYERS_SESSION

Requests that the name server supply its group list for the specified session.

This method is often called immediately after the DirectPlay object is opened, and will enumerate using the local player list for the current session by default. The IDirectPlay::EnumPlayers method may be called after the IDirectPlay::EnumSessions method in order to obtain a list of players in a particular session. IDirectPlay::EnumPlayers uses the DPENUMPLAYERS_SESSION flag and the session ID returned from the IDirectPlay::EnumSessions method to obtain this list. However, it cannot be called from within an IDirectPlay::EnumSessions enumeration. The use of the DPENUMPLAYERS_SESSION flag with this method must occur after the IDirectPlay::EnumSessions method has been called and before either the IDirectPlay::Close or the IDirectPlay::Open method has been called.