Platform SDK: DirectX |
The DirectPlay4.CreatePlayer method creates a local player for the current session.
object.CreatePlayer(friendlyName As String, _ formalName As String, _ receiveEvent As Long, _ flags As CONST_DPPLAYERFLAGS) As Long
If it succeeds, the method returns a unique player ID.
If the method fails, an error is raised and Err.Number may be set to one of the following values:
DPERR_CANTADDPLAYER |
DPERR_CANTCREATEPLAYER |
DPERR_CONNECTIONLOST |
DPERR_INVALIDFLAGS |
DPERR_INVALIDPARAMS |
DPERR_NOCONNECTION |
A single process can have multiple local players that communicate through a DirectPlay object with other players on the same computer or players on remote computers.
Upon successful completion, this method sends a DPSYS_CREATEPLAYERORGROUP system message to all the other players in the session announcing that a new player has joined the session. By default, all local players receive copies of all the system messages.
Your application should use the player ID returned to the application to identify the player for message passing and data association. Player and group IDs assigned by DirectPlay will always be unique within the session.
Only the application that created the player can:
If the application closes the session, any local players created will be automatically destroyed. Using the DirectPlay4.DestroyPlayer method, the session host or the application that created the player can destroy the player at any time.
DirectPlay4.GetDPEnumPlayers, DirectPlay4.GetPlayerFlags, DirectPlay4.Send, DirectPlay4.SetPlayerData, DirectPlay4.SetPlayerName, DirectX7.CreateEvent