Platform SDK: DirectX

DirectPlay4.GetDPEnumPlayers

The DirectPlay4.GetDPEnumPlayers method enumerates the players and, optionally, groups in the current open session. If there is no open session, players in a remote session can be enumerated.

object.GetDPEnumPlayers(sessionGuid As String, _
    flags As CONST_DPENUMPLAYERFLAGS) _
    As DirectPlayEnumPlayers

Parameters

object
Object expression that resolves to a DirectPlay4 object.
sessionGuid
This parameter should be "" to enumerate players in the currently open session. If there is no open session, this parameter can be a GUID identifying the session to be enumerated. The GUID must belong to one of the sessions enumerated by DirectPlay4.GetDPEnumSessions. This parameter is ignored unless the DPENUMPLAYERS_SESSION flag is specified.
flags
Flags specifying how the enumeration is to be done. Default (flags = 0) enumerates all players in the current active session. Only players that meet all the criteria of the combined flags will be enumerated. For example, if you specify (DPENUMPLAYERS_LOCAL Or DPENUMPLAYERS_SPECTATOR) only players that are local and are spectator players will be enumerated. If you specify (DPENUMPLAYERS_LOCAL Or DPENUMPLAYERS_REMOTE), no players will be enumerated, because no player can be both local and remote.

Can be one or more of the following values from the CONST_DPENUMPLAYERFLAGS enumeration:

DPENUMPLAYERS_ALL
DPENUMPLAYERS_GROUP
DPENUMPLAYERS_LOCAL
DPENUMPLAYERS_REMOTE
DPENUMPLAYERS_SERVERPLAYER
DPENUMPLAYERS_SESSION
DPENUMPLAYERS_SPECTATOR

Return Values

If the method succeeds, it returns a DirectPlayEnumPlayers object.

Error Codes

If the method fails, an error is raised and Err.Number may be set to one of the following values:

DPERR_ACCESSDENIED
DPERR_CONNECTIONLOST
DPERR_INVALIDPARAMS
DPERR_NOSESSIONS
DPERR_UNAVAILABLE

This method returns DPERR_INVALIDPARAMS if an invalid sessionGuid or invalid flags were supplied. It returns DPERR_NOSESSIONS if there is no open session. It returns DPERR_UNAVAILABLE if the remote session could not be enumerated.

Within a lobby session, this method will always return DPERR_ACCESSDENIED.

Remarks

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 a DirectPlay4.GetDPEnumSessions enumeration. Furthermore, use of the DPENUMPLAYERS_SESSION flag with this method must occur after the GetDPEnumSessions method has been called, and before any calls to the DirectPlay4.Close or DirectPlay4.Open methods.

See Also

DirectPlay4.CreatePlayer, DirectPlay4.DestroyPlayer, Using GUIDs