IDirectPlayLobby3::ConnectEx
IDirectPlayLobby3 InterfaceConnects 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 Microsoft® 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.
Syntax
HRESULT ConnectEx(
DWORD dwFlags,
REFIID riid,
LPVOID *lplpDP,
IUnknown FAR *pUnk
);Parameters
- dwFlags
- Flags indicating how the connection is to be done. By default (dwFlags = 0), the method returns after a connection has been established or the operation has timed out.
- DPCONNECT_RETURNSTATUS
- Returns immediately with the status of the connection. The application must continue calling ConnectEx until a success or error code is returned.
- riid
- The IID of the specific DirectPlay COM interface to be returned; for example, IID_IDirectPlay4A.
- lplpDP
- Pointer to a pointer to be initialized with the DirectPlay interface as specified by the riid parameter.
- pUnk
- Pointer to the containing IUnknown interface. This parameter is provided for future compatibility with COM aggregation features. Presently, however, IDirectPlayLobby3::ConnectEx returns an error if this parameter is anything but NULL.
Return Value
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.
Remarks
There is an upper limit of one minute on connection timeout.
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.
See Also
IDirectPlayLobby3::ConnectEx
Top of Page
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.