DirectX SDK

DirectPlay4.GetDPEnumGroupPlayers

The DirectPlay4.GetDPEnumGroupPlayers method enumerates the players belonging to a specific group in the currently open session.

GetDPEnumGroupPlayers(GroupId As Long, _
    sessionGuid As String, _
    flags As CONST_DPENUMPLAYERFLAGS) _
    As DirectPlayEnumPlayers

Parameters

object
Object expression that resolves to a DirectPlay4 object.
GroupId
DirectPlay ID of the group whose players are to be enumerated.
sessionGuid
Globally unique identifier (GUID) identifying the session to be enumerated. This parameter is ignored unless the DPENUMPLAYERS_SESSION flag is specified. The GUID must be equal to one of the sessions enumerated by the DirectPlay4.GetDPEnumSessions method.
flags
Flags specifying how the enumeration is to be done. The default (flags = 0) enumerates players in a group in the current active session. You should use a logical Or operation to combine the flags that you want to specify. 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 in the group 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_LOCAL
DPENUMPLAYERS_OWNER
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_INVALIDGROUP
DPERR_NOSESSIONS
DPERR_UNAVAILABLE

This method returns DPERR_ACCESSDENIED if the session is a lobby session you are not connected to. It returns DPERR_INVALIDPARAMS if an invalid sessionGuid or invalid flags were supplied. It returns DPERR_NOSESSIONS if there is no active session. It returns DPERR_UNAVAILABLE if the session could not be enumerated.

Remarks

Password-protected remote sessions cannot be enumerated. You cannot use the method in a lobby session you are not connected to.

By default, this method will enumerate all players in the current session. 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. Use of the DPENUMPLAYERS_SESSION flag with this method must occur after the DirectPlay4.GetDPEnumSessions method has been called, and before any calls to the DirectPlay4.Close or DirectPlay4.Open methods.

See Also

DirectPlay4.CreatePlayer, DirectPlay4.DestroyPlayer, DirectPlay4.AddPlayerToGroup, DirectPlay4.DeletePlayerFromGroup, Using GUIDs