HRESULT Send(DPID pidFrom, DPID pidTo, DWORD dwFlags,
LPVOID lpvBuffer, DWORD dwBuffSize);
Sends messages to other players, to other groups of players, or to all players in the session.
·Returns DP_OK if successful, the number of messages waiting for transmission in DirectPlay's internal queue, or one of the following error values:
DPERR_BUSY | DPERR_INVALIDOBJECT |
DPERR_INVALIDPLAYER | DPERR_SENDTOOBIG |
pidFrom
ID of the sending player.
pidTo
ID of the receiving player.
dwFlags
Indicates how the message should be sent. Not all options may be supported by a particular service provider.
Sends the message using a reliable method. Retries until the message is received or until the DirectPlay time-out occurs.
Sends the message as a HIGHPRIORITY message.
Sends the message without error detection and without retry options enabled.
lpvBuffer
Address for the message being sent.
dwBuffSize
Length of the message being sent.
To send a message to another player, specify the appropriate player ID. To send a message to a group of players, send the message to the player ID assigned to the previously created group. To send messages to the entire session, specify the player ID 0, which always represents the name server. IDirectPlay::Send will either return one of the values listed above or the number of messages currently queued for transmission. If the internal queue fills to the limit specified by the dwMaxQueueSize member of the DPCAPS structure, an error will be generated and the message will not be added to the queue. The IDirectPlay::Send method cannot be used inside an IDirectDrawSurface::Lock / IDirectDrawSurface::Unlock or IDirectDrawSurface::GetDC / IDirectDrawSurface::ReleaseDC method pair.