IDirectPlay4::SendChatMessage

IDirectPlay4 Interface

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.

Syntax

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 Value

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 seession.

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

See Also

DPCHAT, DPMSG_CHAT, IDirectPlay4::Send


Top of Page Top of Page
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.