Platform SDK: DirectX |
Messages returned by the IDirectPlay4::Receive method from player ID DPID_SYSMSG are system messages. All system messages begin with an identifier specified by the dwType value. You can cast the buffer returned by the IDirectPlay4::Receive method to a generic message (DPMSG_GENERIC) and examine the dwType element, which will have a value equal to one of the message type identifiers with the DPSYS_ prefix. After the application has determined which system message it is, the buffer should be cast to the appropriate structure (beginning with the DPMSG_ prefix) to read the data.
Your application should be prepared to handle the following system messages.
Value of dwType | Message structure | Cause |
---|---|---|
DPSYS _ADDGROUPTOGROUP |
DPMSG_ADDGROUPTOGROUP | An existing group has been added to an existing group. |
DPSYS _ADDPLAYERTOGROUP |
DPMSG_ADDPLAYERTOGROUP | An existing player has been added to an existing group. |
DPSYS_CHAT | DPMSG_CHAT | A chat message has been received. |
DPSYS _CREATEPLAYERORGROUP |
DPMSG_CREATEPLAYERORGROUP | A new player or group has been created. |
DPSYS _DELETEGROUPFROMGROUP |
DPMSG_DELETEGROUPFROMGROUP | A group has been removed from a group. |
DPSYS _DELETEPLAYERFROMGROUP |
DPMSG_DELETEPLAYERFROMGROUP | A player has been removed from a group. |
DPSYS _DESTROYPLAYERORGROUP |
DPMSG_DESTROYPLAYERORGROUP | An existing player or group has been destroyed. |
DPSYS_HOST | DPMSG_HOST | The current host has left the session and this application is the new host. |
DPSYS _SECUREMESSAGE |
DPMSG_SECUREMESSAGE | A digitally signed or encrypted message has been received. |
DPSYS _SENDCOMPLETE |
DPMSG_SENDCOMPLETE | An asynchronous send is complete. |
DPSYS _SESSIONLOST |
DPMSG_SESSIONLOST | The connection with the session has been lost. |
DPSYS _SETGROUPOWNER |
DPMSG_SETGROUPOWNER | The owner of the group has changed. |
DPSYS _SETPLAYERORGROUPDATA |
DPMSG_SETPLAYERORGROUPDATA | Player or group data has changed. |
DPSYS _SETPLAYERORGROUPNAME |
DPMSG_SETPLAYERORGROUPNAME | Player or group name has changed. |
DPSYS _SETSESSIONDESC |
DPMSG_SETSESSIONDESC | Session description has changed. |
DPSYS _STARTSESSION |
DPMSG_STARTSESSION | Lobby server is requesting that a session be started. |
Messages returned by the DirectPlay4.Receive method that are marked as being from player ID DPID_SYSMSG are system messages. All system messages begin with a Long type identifier.
In order to parse a system message, you must first retrieve its type identifier by using DirectPlayMessage.ReadLong method. You then use the various read methods of DirectPlayMessage in order to extract elements of the message data. Elements must be extracted in the order documented for the message type. (See CONST_DPSYSMSGTYPES.)
In addition to all the standard read methods that are used for player messages as well as system messages, DirectPlay provides the following methods for parsing system messages:
Note that ReadSysChatString, ReadSysMsgConnection, and ReadSysMsgSessionDesc can be called regardless of the position of the read pointer, and calling these methods does not advance the read pointer. On the other hand, ReadSysMsgData can be called only when all preceding data in the message has been retrieved, and calling it advances the read pointer. The reason for this behavior is that the first three methods always know where to find their data in the underlying message structure, whereas ReadSysMsgData can be used to extract data from different locations in different message types.