DirectX SDK

IDirectPlay4::SetSessionDesc

The IDirectPlay4::SetSessionDesc method changes the properties of the current session. Only the host of the session can change the session properties. If a nonhost attempts to call it, the method returns DPERR_ACCESSDENIED.

The updated session description will be propagated to all the other computers in the session. Each player will receive a DPMSG_SETSESSIONDESC system message.

You can't use SetSessionDesc in a lobby session.

HRESULT SetSessionDesc(
  LPDPSESSIONDESC2 lpSessDesc,
  DWORD dwFlags
);

Parameters

lpSessDesc
Pointer to the DPSESSIONDESC2 structure containing the new settings.
dwFlags
No flags are currently used by this method.

Return Values

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

DPERR_ACCESSDENIED
DPERR_CONNECTIONLOST
DPERR_INVALIDPARAMS
DPERR_NOSESSIONS

This method returns DPERR_ACCESSDENIED if this computer does not have permission to change the session. Only the host can change the session properties. It returns DPERR_INVALIDPARAMS if the application attempts to change a property in the session description that cannot be changed or tries to give a property an invalid value.

Remarks

Changing the session description will cause a DPMSG_SETSESSIONDESC system message to be generated on all the other computers in the session.

The following members and flags of the DPSESSIONDESC2 structure can be changed using IDirectPlay4::SetSessionDesc:

dwFlags
DPSESSION_JOINDISABLED

DPSESSION_NEWPLAYERSDISABLED

DPSESSION_NODATAMESSAGES

DPSESSION_PRIVATE

dwMaxPlayers
If you set the maximum players to a value less than the current number of players, the method returns DPERR_INVALIDPARAMS.
lpszSessionName / lpszSessionNameA
lpszPassword / lpszPasswordA
dwUser1
dwUser2
dwUser3
dwUser4

If the following members and flags of the DPSESSIONDESC2 structure are changed, an error will occur (for example, if the DPSESSION_KEEPALIVE flag is currently set and you try to set this bit, you will not get an error, but if you try to clear this bit, you will get an error and IDirectPlay4::SetSessionDesc will fail):

dwSize
dwFlags
DPSESSION_NOMESSAGEID

DPSESSION_KEEPALIVE

The following members of the DPSESSIONDESC2 structure are ignored (that is, it does not matter what you pass in these members; DirectPlay will always use the values passed when IDirectPlay4::Open was called):

guidInstance
guidApplication
dwCurrentPlayers
dwReserved1
dwReserved2

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

DPSESSIONDESC2, IDirectPlay4::GetSessionDesc