DirectX SDK |
The IDirectPlay4::EnumPlayers method enumerates the players in the current 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 session that matches the criteria specified in dwFlags.
Within a lobby session, this method will always return DPERR_ACCESSDENIED.
HRESULT EnumPlayers( LPGUID lpguidInstance, LPDPENUMPLAYERSCALLBACK2 lpEnumPlayersCallback2, LPVOID lpContext, DWORD dwFlags );
Can be one or more of the following values:
Returns DP_OK if successful, or one of the following error values otherwise:
DPERR_CONNECTIONLOST |
DPERR_INVALIDPARAMS |
DPERR_NOSESSIONS |
DPERR_UNAVAILABLE |
This method returns DPERR_INVALIDPARAMS if an invalid callback, an invalid guidInstance, 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.
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 IDirectPlay4::EnumSessions enumeration. Furthermore, use of the DPENUMPLAYERS_SESSION flag with this method must occur after the IDirectPlay4::EnumSessions method has been called, and before any calls to the IDirectPlay4::Close or IDirectPlay4::Open methods.
Windows NT/2000: Requires Windows 2000.
Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
Header: Declared in dplay.h.
Import Library: Use dplayx.lib.
IDirectPlay4::CreatePlayer, IDirectPlay4::DestroyPlayer, IDirectPlay4::EnumSessions