IDirectPlay::Receive

HRESULT Receive(LPDPID lppidFrom, LPDPID lppidTo,

DWORD dwFlags, LPVOID lpvBuffer, LPDWORD lpdwSize);

Retrieves a message from the message queue.

·Returns DP_OK if successful, or one of the following error values otherwise:

DPERR_BUFFERTOOSMALL DPERR_GENERIC
DPERR_INVALIDOBJECT DPERR_INVALIDPARAMS
DPERR_NOMESSAGES  

lppidFrom

Address for a DPID structure to be filled with the sender's player ID.

lppidTo

Address for a DPID structure to be filled with the receiver's player ID.

dwFlags

Specifies the optional control flags.

DPRECEIVE_ALL

Returns the first available message. This is the default.

DPRECEIVE_FROMPLAYER

Returns the first message from the player ID that the lppidFrom parameter points to.

DPRECEIVE_PEEK

Returns a message as specified by the other flags, but does not remove it from the message queue.

DPRECEIVE_TOPLAYER

Returns the first message intended for the player ID that the lppidTo parameter points to. System messages are addressed to player ID 0.

lpvBuffer

Address for the message buffer. If this buffer is not long enough to hold the message, an error will be returned and lpdwSize will be filled with the size of message buffer needed.

lpdwSize

Address for the doubleword that specifies the length of the message buffer.

Any message received from player ID 0 is a system message from the name server. A message sent to the name server to broadcast to all players still appears to be from the sender. Both the DPRECEIVE_TOPLAYER and DPRECEIVE_FROMPLAYER flags can be specified, in which case IDirectPlay::Receive will return whichever message is encountered first.