Platform SDK: DirectX |
This tutorial pertains only to applications written in C++. See DirectPlay Visual Basic Tutorials.
After the session description is properly configured, your application can use the IDirectPlayLobby3::ConnectEx method to start and connect itself to a session. If this method returns DP_OK, you can create one or more players. If it returns DPERR_NOTLOBBIED, the user will have to manually select a communication medium for your application. (You can identify the service providers installed on the system by using the IDirectPlay4::EnumConnections method.) If any other error value is returned, your application should report an error that indicates that lobbying the application failed.
The following example shows how to connect to a session:
if ( FAILED( hr = g_pDPLobby->ConnectEx( 0, IID_IDirectPlay4A, (VOID**)&g_pDP, NULL ) ) ) return hr;
Next: Step 5: Create a Player