DirectX SDK

IDirectPlay4::DestroyPlayer

The IDirectPlay4::DestroyPlayer method deletes a local player from the session, removes any pending messages destined for that player from the message queue, and removes the player from any groups to which the player belonged. The player ID will not be reused during the current session.

In general, only the application that created the player can destroy the player. However, the host of the session can also destroy the player.

HRESULT DestroyPlayer(
  DPID idPlayer
);

Parameters

idPlayer
Player ID of the locally owned player to be removed from the session. When DestroyPlayer is called by the host of the session, this ID can be that of any player, local or remote.

Return Values

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

DPERR_ACCESSDENIED
DPERR_CONNECTIONLOST
DPERR_INVALIDOBJECT
DPERR_INVALIDPLAYER
DPERR_UNAVAILABLE

Remarks

This method generates a DPMSG_DELETEPLAYERFROMGROUP system message for each group that the player belongs to and then generates a DPMSG_DESTROYPLAYERORGROUP system message.

A player cannot be destroyed if the player has pending asynchronous messages in the send queue. All messages must either be completed or canceled.

Requirements

  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.

See Also

IDirectPlay4::CreatePlayer, DPMSG_DESTROYPLAYERORGROUP