Platform SDK: DirectX

DirectPlay4.DestroyPlayer

The DirectPlay4.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.

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

object.DestroyPlayer(playerId As Long) 

Parameters

object
Object expression that resolves to a DirectPlay4 object.
playerId
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.

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_INVALIDOBJECT
DPERR_INVALIDPLAYER
DPERR_UNAVAILABLE

Remarks

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

A player cannot be destroyed if the player has pending asynchronous messages in the send queue. This method removes any pending messages destined for that player from the message queue.

The player ID will not be reused during the current session.

See Also

DirectPlay4.CreatePlayer