Microsoft DirectX 8.1 (C++) |
LobbyClient is a simple lobby client application. It displays all registered Microsoft® DirectPlay® applications on the local system. It enables the user to launch one or more of these applications using a chosen service provider. A launched lobbied application can be told to either join or host a game.
Source: (SDK root)\Samples\Multimedia\DirectPlay\LobbyClient
Executable: (SDK root)\Samples\Multimedia\DirectPlay\Bin
The LobbyClient sample displays a dialog box that allows you to choose launch parameters before starting the application by clicking Launch App. The Active Connections list will display the handle to all current lobbied applications. Clicking Send Message will send a lobby message to the lobbied application. This done mainly for demonstration purposes. A more complex lobby client might want to use this functionality in a more meaningful way by passing a message to which the lobbied application responds.
The InitDirectPlay() function does the following:
The OnInitDialog() function does the following:
When Launch App is clicked, the LaunchApp() function does the following:
The DirectPlayLobbyMessageHandler() function can handle the following messages:
DPL_MSGID_DISCONNECT | The lobbied application was disconnected. The pDisconnectMsg–>hDisconnectId parameter will contain the handle of the lobbied application that was disconnected and the pDisconnectMsg–>hrReason parameter will contain the reason. This sample pops up a message box. |
DPL_MSGID_RECEIVE | The lobbied application sent the client data. This sample does not respond to any message. |
DPL_MSGID_SESSION_STATUS | A lobbied application has changed its status. The pStatusMsg–>hSender parameter will be one of several predefined status codes. This sample updates the UI, showing that the lobby status has been updated. However, more complex lobby clients many want to take action. |
DPL_MSGID_CONNECTION_SETTINGS | A lobbied application has changed its connection settings. This lobby client takes no action. However, more complex clients might want to take action. |
When Send Message is clicked, the SendMsgToApp() function calls IDirectPlay8LobbyClient::Send(). The hConnection parameter is set to the handle of the receiving lobbied application and the pBuffer parameter is set to the message buffer.
When Disconnect is clicked, the DisconnectFromApp() function calls IDirectPlay8LobbyClient::ReleaseApplication(). The hApplication parameter is set to the handle of the lobbied application from which to disconnect.