Platform SDK: DirectX |
This tutorial pertains only to applications written in Visual Basic. See DirectPlay C/C++ Tutorials
The application is now part of an open session, but the user cannot participate until a player has been created.
This is a very simple step. The application passes a couple of names to DirectPlay4.CreatePlayer, and the method returns a unique numerical ID for the player. This ID is important because it identifies the player in messages. In Memory it is kept in the global variable gMyPlayerID.
In the Memory sample, the PlayerName string is the name supplied by the user. (A default string is retrieved from the system by a call to the Win32 GetUserName function.) The application uses this as a friendly name for the player. PlayerHandle can be used internally for other purposes but is not needed by Memory.
PlayerName = frmMultiplayer.txtYourName.Text PlayerHandle = "Player" On Error GoTo FAILEDCREATE gMyPlayerID = gObjDPlay.CreatePlayer(PlayerName, PlayerHandle, 0, 0)