Platform SDK: DirectX

DirectPlay4.SetSessionDesc

The DirectPlay4.SetSessionDesc method changes the properties of the current session. Only the host of the session can change the session properties.

This method cannot be used in a lobby session.

object.SetSessionDesc(sessionDesc As DirectPlaySessionData)

Parameters

object
Object expression that resolves to a DirectPlay4 object.
sessionDesc
DirectPlaySessionData object containing the new settings. This object is obtained by using the DirectPlay4.GetSessionDesc method, and its methods are used to change the data. See Remarks.

Error Codes

If the method fails, an error is raised and Err.Number may be set to one of the following values:

DPERR_ACCESSDENIED
DPERR_CONNECTIONLOST
DPERR_INVALIDPARAMS
DPERR_NOSESSIONS

This method returns DPERR_ACCESSDENIED if this computer does not have permission to change the session. 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

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

The following methods can be used to set elements of the session description that can be changed:

DirectPlaySessionData.SetFlags
The following flags can be added or removed:

DPSESSION_JOINDISABLED
DPSESSION_NEWPLAYERSDISABLED
DPSESSION_NODATAMESSAGES
DPSESSION_PRIVATE

The following flags must remain unchanged, else an error will result when SetSessionDesc is called:
DPSESSION_NOMESSAGEID
DPSESSION_KEEPALIVE
DirectPlaySessionData.SetMaxPlayers
If you set the maximum players to a value less than the current number of players, the method returns DPERR_INVALIDPARAMS.
DirectPlaySessionData.SetSessionName
DirectPlaySessionData.SetSessionPassword
DirectPlaySessionData.SetUser1
DirectPlaySessionData.SetUser2
DirectPlaySessionData.SetUser3
DirectPlaySessionData.SetUser4

If you change other properties of the object by calling DirectPlaySessionData.SetGuidInstance or DirectPlaySessionData.SetGuidApplication, the new settings are ignored—that is, DirectPlay will always use the values set when DirectPlay4.Open was called.

See Also

DirectPlay4.GetSessionDesc