Index Topic Contents | |||
Previous Topic: IDirectPlay3::EnumConnections Next Topic: IDirectPlay3::EnumGroups |
IDirectPlay3::EnumGroupPlayers
IDirectPlay3 InterfaceEnumerates the players belonging to a specific group in the currently open session. If there is no open session, players in a remote session can be enumerated by specifying the DPENUMPLAYERS_SESSION flag and the guidInstance of the session. Password protected remote sessions cannot be enumerated.
A pointer to an application-implemented callback function must be supplied, and DirectPlay calls it once for each player in the group that matches the criteria specified in dwFlags.
You can't use EnumGroupPlayers in a lobby session you're not connected to.
HRESULT EnumGroupPlayers(
DPID idGroup,
LPGUID lpguidInstance,
LPDPENUMPLAYERSCALLBACK2 lpEnumPlayersCallback2,
LPVOID lpContext,
DWORD dwFlags
);Parameters
- idGroup
- DPID of the group whose players are to be enumerated.
- lpguidInstance
- Pointer to a 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 IDirectPlay3::EnumSessions.
- lpEnumPlayersCallback2
- Pointer to the EnumPlayersCallback2 function that will be called for every player in the group that matches the criteria specified in dwFlags.
- lpContext
- Pointer to an application-defined context that is passed to each enumeration callback.
- dwFlags
- Flags specifying how the enumeration is to be done. The default (dwFlags = 0) enumerates players in a group in the current active session. You should OR together 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 | DPENUMPLAYERS_SPECTATOR) only players in the group that are local and are spectator players will be enumerated. If you specify (DPENUMPLAYERS_LOCAL | 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:
- DPENUMPLAYERS_LOCAL
- Enumerates players created locally by this DirectPlay object.
- DPENUMPLAYERS_REMOTE
- Enumerates players created by remote DirectPlay objects.
- DPENUMPLAYERS_SERVERPLAYER
- Enumerates the server player.
- DPENUMPLAYERS_SESSION
- Enumerates the players for the session identified by lpguidInstance. This flag can only be used if there is no current open session. This flag can't be used in a lobby session.
- DPENUMPLAYERS_SPECTATOR
- Enumerates players who are spectator players.
Return Values
Returns DP_OK if successful, or one of the following error messages otherwise:
- DPERR_ACCESSDENIED
- DPERR_INVALIDPARAMS
- DPERR_INVALIDGROUP
- DPERR_NOSESSIONS
- DPERR_UNAVAILABLE
This method returns DPERR_ACCESSDENIED if the session is a lobby session you're not connected to. It returns DPERR_INVALIDPARAMS if an invalid callback, an invalid guidInstance, 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
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 IDirectPlay3::EnumSessions method has been called, and before any calls to the IDirectPlay3::Close or IDirectPlay3::Open methods.
See Also
IDirectPlay3::CreatePlayer, IDirectPlay3::DestroyPlayer, IDirectPlay3::AddPlayerToGroup, IDirectPlay3::DeletePlayerFromGroup
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.