DirectX SDK |
The IDirectPlay4::StartSession method launches a DirectPlay session from a staging area. Call SetGroupConnectionSettings first to specify what application to launch, which service provider to use, and what session description to use.
When StartSession is called, each player in the group receives a DPMSG_STARTSESSION instructing the player to launch the session.
HRESULT StartSession( DWORD dwFlags, DPID idGroup );
Returns DP_OK if successful or one of the following error values:
DPERR_ACCESSDENIED |
DPERR_CONNECTIONLOST |
DPERR_INVALIDFLAGS |
DPERR_INVALIDGROUP |
DPERR_INVALIDPARAMS |
This method returns DPERR_INVALIDGROUP if the given group ID is not a valid staging area.
A player joining a staging area group for which the session has already started can call this method to join the session. The player will receive a DPMSG_STARTSESSION message instructing it how to join the session.
You can determine if a session is already in progress by calling IDirectPlay4::GetGroupConnectionSettings and examining the guidInstance parameter it returns through a pointer in the DPLCONNECTION structure to the DPSESSIONDESC2 structure. If guidInstance is GUID_NULL, no session is in progress. If it is any other value, a session is already in progress.
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.