Platform SDK: DirectX

Using Lobby Messages

Lobby messages fall into two categories: DirectPlay-defined messages and application-defined messages.

DirectPlay-defined messages can be system messages, generated automatically by DirectPlay and sent to the lobby to inform it of changes in the status of the application, or standard message types, sent from the application to the lobby or from the lobby to the application.

The advantage of standard messages over application-defined messages is that the receiver can always interpret a standard message. A lobby client is not necessarily going to be able to handle custom messages from an application, just as an application may not be able to handle custom messages from a lobby client.

[C++]

Lobby messages are retrieved by using the IDirectPlayLobby3::ReceiveLobbyMessage method. The message category can be identified by the value returned in the variable pointed to by the lpdwMessageFlags parameter. If neither DPLMSG_SYSTEM or DPLMSG_STANDARD is present, the message is application-defined.

Lobbies should be prepared to handle all the standard message types. If an application uses the DPLMSG_GETPROPERTY message, it must be able to handle DPLMSG_GETPROPERTYRESPONSE messages. (See Staying in Touch with the Lobby.)

DirectPlay-defined messages all start with a DWORD value that identifies the message type. After retrieving a message using ReceiveLobbyMessage, cast *lpData to the DPLMSG_GENERIC structure and examine the structure's dwType member. Then cast *lpData to the appropriate message structure for further processing.

The following table shows the possible values of DPLMSG_GENERIC.dwType for standard messages, and the structure and message cause associated with each value.

Value of dwType Message structure Cause
DPLSYS
_APPTERMINATED
DPLMSG_SYSTEMMESSAGE The application has terminated.
DPLSYS
_CONNECTIONSETTINGSREAD
DPLMSG_SYSTEMMESSAGE The application has read the connection settings.
DPLSYS
_DPLAYCONNECTFAILED
DPLMSG_SYSTEMMESSAGE The application failed to connect to the DirectPlay session.
DPLSYS
_DPLAYCONNECTSUCCEEDED
DPLMSG_SYSTEMMESSAGE The application successfully connected to the DirectPlay session.
DPLSYS
_GETPROPERTY
DPLMSG_GETPROPERTY The application is requesting a property from the lobby. See Staying in Touch with the Lobby.
DPLSYS
_GETPROPERTYRESPONSE
DPLMSG_GETPROPERTYRESPONSE The lobby is responding to a DPLMSG_GETPROPERTY message. See Staying in Touch with the Lobby.
DPLSYS
_NEWCONNECTIONSETTINGS
DPLMSG_SYSTEMMESSAGE A waiting application was found when a lobby client called RunApplication. See Supporting Dynamic Lobby Connection.
DPLSYS
_NEWSESSIONHOST
DPLMSG_NEWSESSIONHOST The application session has a new host.
DPLSYS
_SETPROPERTY
DPLMSG_SETPROPERTY The application is setting a property on the lobby. See Staying in Touch with the Lobby.
DPLSYS
_SETPROPERTYRESPONSE
DPLMSG_SETPROPERTYRESPONSE The lobby is responding to a DPLMSG_SETPROPERTY message. See Staying in Touch with the Lobby.

[Visual Basic]

Lobby messages are retrieved by using the DirectPlayLobby3.ReceiveLobbyMessage method. The message category can be identified by the value returned in the messageFlags parameter. If neither DPLMSG_SYSTEM or DPLMSG_STANDARD is present, the message is application-defined.

Lobbies should be prepared to handle all the standard message types. If an application uses the DPLSYS_GETPROPERTY message, it must be able to handle DPLSYS_GETPROPERTYRESPONSE messages. (See Staying in Touch with the Lobby.)

DirectPlay-defined messages all start with a value from the CONST_DPSYSMSGTYPES enumeration that identifies the message type. You retrieve this value by using DirectPlayMessage.ReadLong.

The following table shows the message type and the message cause associated with each value.

Message Type Cause
DPLSYS
_APPTERMINATED
The application has terminated.
DPLSYS
_CONNECTIONSETTINGSREAD
The application has read the connection settings.
DPLSYS
_DPLAYCONNECTFAILED
The application failed to connect to the DirectPlay session.
DPLSYS
_DPLAYCONNECTSUCCEEDED
The application successfully connected to the DirectPlay session.
DPLSYS
_GETPROPERTY
The application is requesting a property from the lobby. See Staying in Touch with the Lobby.
DPLSYS
_GETPROPERTYRESPONSE
The lobby is responding to a DPLMSG_GETPROPERTY message. See Staying in Touch with the Lobby.
DPLSYS
_NEWCONNECTIONSETTINGS
A waiting application was found when a lobby client called RunApplication. See Supporting Dynamic Lobby Connection.
DPLSYS
_NEWSESSIONHOST
The application session has a new host.
DPLSYS
_SETPROPERTY
The application is setting a property on the lobby. See Staying in Touch with the Lobby.
DPLSYS
_SETPROPERTYRESPONSE
The lobby is responding to a DPLMSG_SETPROPERTY message. See Staying in Touch with the Lobby.