Messages returned by the IDirectPlayLobby2::ReceiveLobbyMessage method fall into two categories: DirectPlay-defined messages and custom-defined messages. The message category can be identified by the lpdwMessageFlags parameter of ReceiveLobbyMessage. The flags indicate that the message is either a system message (the DPLMSG_SYSTEM flag) or a standard message (the DPLMSG_STANDARD flag). If neither of these flags is set, the message is custom-defined. System messages are generated automatically by DirectPlay and sent only to the lobby to inform it of changes in the status of the application. Standard messages can be generated by either the lobby or the application and sent to the other.
The advantage of standard messages over custom-defined messages is that the receiver can positively interpret the message. It is not required that all applications or lobbies act on standard messages.
DirectPlay-defined messages all start with a DWORD value that identifies the type of the message. After retrieving a message using ReceiveLobbyMessage, the lpData pointer to the message data should be cast to the DPLMSG_GENERIC structure and the structure's dwType member examined. Based on the value of dwType, the lpData pointer should then be cast to the appropriate message structure for further processing.
Lobbies should be prepared to handle all the following message types. Applications need to handle the DPLMSG_GETPROPERTYRESPONSE message if they generate DPLMSG_GETPROPERTY messages.
Messages returned by the IDirectPlayLobby2::ReceiveLobbyMessage method that have a dwFlags parameter set to DPLMSG_SYSTEM are system messages. All system messages begin with a double-word value specified by dwType. You can cast the buffer returned by the IDirectPlayLobby2::ReceiveLobbyMessage method to a generic message (DPLMSG_GENERIC) and switch on the dwType element, which will have a value equal to one of the messages with the DPLSYS_ prefix.
The following list shows the possible values of the dwType data member, and the message structure and message cause associated with each value.
Value of dwType | Message structure | Cause |
DPLSYS_APPTERMINATED | DPLMSG_GENERIC | The application has terminated. |
DPLSYS_CONNECTIONSETTINGSREAD | DPLMSG_GENERIC | The application has read the connection settings. |
DPLSYS_DPLAYCONNECTFAILED | DPLMSG_GENERIC | The application failed to connect to the DirectPlay session. |
DPLSYS_DPLAYCONNECTSUCCEEDED | DPLMSG_GENERIC | The application successfully connected to the DirectPlay session. |
DPLSYS_GETPROPERTY | DPLMSG_GETPROPERTY | The application is requesting a property from the lobby. |
DPLSYS_GETPROPERTYRESPONSE | DPLMSG_GETPROPERTYRESPONSE | The lobby is responding to a prior DPLMSG_GETPROPERTY message. |
DPLSYS_SETPROPERTY | DPLMSG_SETPROPERTY | The application is setting a property on the lobby. |
DPLSYS_SETPROPERTYRESPONSE | DPLMSG_SETPROPERTYRESPONSE | The lobby is responding to a prior DPLMSG_SETPROPERTY message. |