Platform SDK: DirectX |
The IDirectPlayLobby3::ConnectEx method connects an application to the session specified by the DPLCONNECTION structure currently stored with the DirectPlayLobby object.
This method is an extended version of the Connect method. This version allows the application to specify which version of the DirectPlay\ COM interface to return.
By default, ConnectEx returns after a connection is made or the connection has timed out. If you use the DPCONNECT_RETURNSTATUS flag, ConnectEx returns immediately with a DPERR_CONNECTING error code indicating the connection is in progress. The application must continue calling this method periodically until DP_OK or a failure code is returned. The application can cancel the connection by releasing the IDirectPlayLobby3 interface.
HRESULT ConnectEx( DWORD dwFlags, REFIID riid, LPVOID *lplpDP, IUnknown FAR *pUnk );
Returns DP_OK if successful, or one of the following error values otherwise:
DPERR_CONNECTING |
DPERR_INVALIDFLAGS |
DPERR_INVALIDPARAMS |
The method returns DPERR_CONNECTING while the connection operation is in progress. Call the methods again to get an updated status.
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 IDirectPlay4::InitializeConnection, IDirectPlay4::EnumSessions, and IDirectPlay4::Open. The application should not ask the user a name but instead create a player using the player name information in the DPLCONNECTION structure.
Before calling this method, the application can examine the connection settings that will be used to start the application by using the IDirectPlayLobby3::GetConnectionSettings method. The application then can modify these settings and set them by using the IDirectPlayLobby3::SetConnectionSettings method. The application should pay particular attention to the DPSESSIONDESC2 structure to ensure that the proper session properties are set, especially dwFlags, dwMaxPlayers, and the dwUser members.
Windows NT/2000: Requires Windows 2000.
Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
Header: Declared in dplobby.h.
Import Library: Use dplayx.lib.