Used to join a session that has been enumerated by a previous call to IDirectPlay3::EnumSessions or to create a new session that other users can enumerate and join.
HRESULT Open(
LPDPSESSIONDESC2 lpsd,
DWORD dwFlags
);
Returns DP_OK if successful, or one of the following error values otherwise:
This method returns DPERR_ALREADYINITIALIZED if there is already an open session on this DirectPlay object. It returns DPERR_TIMEOUT if the session did not respond to the Open request. It returns DPERR_USERCANCEL if the user canceled the enumeration process(usually by canceling a service provider dialog box).
Once an application has joined a session, it can create a player and start communicating with other players in the session. The application will not receive any messages nor can it send any messages on this DirectPlay object until it creates a local player using IDirectPlay3::CreatePlayer.
In order to have two sessions open simultaneously, the application must create two DirectPlay objects and open a session on each one.
To join a session, it is only necessary to fill in the dwSize and guidInstance members of the DPSESSIONDESC2 structure. The lpszPassword member must also be filled in if the session was marked as password protected. An enumerated session will have the DPSESSION_PASSWORDREQUIRED flag set if it requires a password.
If joining a secure session, you must use SecureOpen to provide login credentials. The enumerated session will have the DPSESSION_SECURESERVER flag set if it requires credentials.
If you specify the DPSESSION_SECURESERVER flag in the DPSESSIONDESC2 structure, the session will be opened with the default security package, NTLM (NT LAN Manager). To specify an alternate security package, use SecureOpen.
When an application attempts to join a session, the server can reject the Open request or ignore it (in which case Open will time-out). Attempting to join a session where new players are disabled, joining is disabled, the player limit has been reached, or an incorrect password is supplied will result in a DPERR_NONEWPLAYERS or DPERR_INVALIDPASSWORD error.
DPSESSIONDESC2, IDirectPlay3::Close, IDirectPlay3::SecureOpen, IDirectPlay3::EnumSessions
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.