Step 5: Creating a Player

If the application was successfully started by using the IDirectPlayLobby2::Connect method, it can now create one or more players. It can use the IDirectPlay3::CreatePlayer method to create a player with the name specified in the DPNAME structure (which was filled in by the IDirectPlayLobby2::GetConnectionSettings method).

The following example shows how to create a player:

// create a player with the name returned in the connection settings

hr = lpDirectPlay3A->CreatePlayer(&dpidPlayer,

lpConnectionSettings->lpPlayerName,

lpDPInfo->hPlayerEvent, NULL, 0, 0);

if FAILED(hr)

goto FAILURE;

Now your application is connected and you are ready to play.