DirectX SDK |
The DirectPlayLobby3.Connect method connects an application to the session specified by the DirectPlayLobbyConnection object currently stored with the DirectPlayLobby3 object.
object.Connect(flags As Long) As DirectPlay4
If it succeeds, the method returns a DirectPlay4 object.
If the method fails, an error is raised and Err.Number may be set to one of the following values:
DPERR_CONNECTING |
DPERR_INVALIDFLAGS |
DPERR_INVALIDINTERFACE |
DPERR_INVALIDOBJECT |
DPERR_INVALIDPARAMS |
DPERR_NOTLOBBIED |
DPERR_OUTOFMEMORY |
By default, Connect returns after a connection is made or when the connection has timed out. If you use the DPCONNECT_RETURNSTATUS flag, Connect returns immediately with a DPERR_CONNECTING error code indicating the connection is in progress. The application must continue calling this method periodically until it succeeds or another failure code is returned. The application can cancel the connection by releasing the DirectPlayLobby3 object.
There is an upper limit of one minute on connection time-out.
After this method is successfully completed, the application can skip the process of calling DirectPlay4.InitializeConnection, DirectPlay4.GetDPEnumSessions, and DirectPlay4.Open. The application should not ask the user for a name but instead create a player using the player name information in the DirectPlayLobbyConnection interface.
Before calling this method, the application can examine the connection settings that will be used to start the application by using the DirectPlayLobby3.GetConnectionSettings method. The application then can modify these settings and set them by using the DirectPlayLobby3.SetConnectionSettings method. The application should pay particular attention to the DirectPlaySessionData object to ensure that the proper session properties are set.