Microsoft DirectX 9.0

Implementing a Lobby Client Message Handler

The message handler is a callback function that is used by the lobby client object to communicate with the lobby client. The lobby client message handler has three parameters that pass in the following information.

The user context value is defined by the lobby client when it calls IDirectPlay8LobbyClient::Initialize. It can be used for such purposes as differentiating between messages that are sent from different objects. For more information about user-context values, see Using Player Context Values.

Your message handler must be able to handle the following five lobby client-specific messages.

Most of these messages are generated by the lobby client object in response to changes in the game status, or when the lobby client requests information. The exception is DPL_MSGID_RECEIVE. This message is used to pass data directly from the game application to the lobby client. See PFNDPNMESSAGEHANDLER for a complete description the message handler function.

Note  Microsoft?DirectPlay?message handlers must be written to work properly in a multithreaded environment, or your application may not function well.


This message is sent by the lobby client following the launch of a lobbyable application. The message indicates that the application has been successfully connected. The associated DPL_MSGID_CONNECT structure holds a variety of information, including:


This message is sent by DirectPlay whenever an associated lobbyable application calls its IDirectPlay8LobbiedApplication::SetConnectionSettings method to modify the session connections. The associated DPL_MSGID_CONNECTION_SETTINGS structure contains the updated connection information.


This message is sent when the lobbyable application disconnects from the session by calling IDirectPlay8LobbiedApplication::Close. Your lobby client application should delete the connection from its list and free any data that is associated with the application.


This message enables an application to pass data to the lobby client. DirectPlay passes the data block from the application to the lobby client in a DPL_MSGID_RECEIVE structure. It is up to the lobby client to process the data.


This message is sent by DirectPlay whenever one of the following six changes in the session's status occurs.

The type of status change is indicated by the value of the dwStatus field in the associated DPL_MSGID_SESSION_STATUS structure.

For more information, see A Sample Lobby Client Message Handler.

© 2002 Microsoft Corporation. All rights reserved.