DirectX SDK

IDirectPlay4::SendChatMessage

The IDirectPlay4::SendChatMessage method sends a text message to another player, a group of players, or all players. This method supports both Unicode (the IDirectPlay4 interface) and ANSI strings (the IDirectPlay4A interface). The player receiving the chat message is informed through a DPMSG_CHAT system message in the player's receive queue. This method must be used in a lobby session.

HRESULT SendChatMessage(
  DPID idFrom,
  DPID idTo,
  DWORD dwFlags,
  LPDPCHAT lpChatMessage
);

Parameters

idFrom
ID of the sending player. The player ID must correspond to one of the local players on this computer.
idTo
ID of the player to send the message to, the group ID of the group of players to send the message to, or DPID_ALLPLAYERS to send the message to all players in the session.
dwFlags
Indicates how the message should be sent. If this parameter is set to 0, the message is sent nonguaranteed.
DPSEND_GUARANTEED
Sends the message by using a guaranteed method of delivery if it is available.
lpChatMessage
Pointer to a DPCHAT structure containing the message to be sent.

Return Values

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

DPERR_ACCESSDENIED
DPERR_CONNECTIONLOST
DPERR_INVALIDFLAGS
DPERR_INVALIDPARAMS
DPERR_INVALIDPLAYER

This method returns DPERR_INVALIDPARAMS if the idTo ID is not a valid player or group. It returns DPERR_INVALIDPLAYER if the idFrom ID is not a valid player. It returns DPERR_ACCESSDENIED if the idFrom ID is not a local player.

Remarks

This method facilitates player-to-player chatting within a lobby session where it is possible for different client applications to be connected. You must use this method in a lobby session. Use is optional in an application session.

The receiving player will receive a system message (idFrom = DPID_SYSMSG). The DPCHAT structure will specify which player the chat message came from.

Requirements

  Windows NT/2000: Requires Windows 2000.
  Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
  Header: Declared in dplay.h.
  Import Library: Use dplayx.lib.

See Also

DPCHAT, DPMSG_CHAT, IDirectPlay4::Send