Message Management

The message-management functions help your application route messages between game players. With the exception of a small number of messages that have been defined by the system, the messages can be defined in any way that you require. Messages should not be excessively large, however. You can use the IDirectPlay::Send method to send a message to an individual player, to a group, or to all the players in the session; simply specify a player ID, a group ID, or 0 as the destination.

To retrieve a message from the message queue, use the IDirectPlay::Receive method. This method allows you to specify whether to retrieve the first message in the queue, only the messages to a particular player, or only those from a particular player. You can use the IDirectPlay::GetMessageCount method to retrieve the number of messages waiting for a given player.