DirectPlay Animated Header -- IDirectPlayLobby2::Connect DirectPlay Animated Header -- IDirectPlayLobby2::Connect* Microsoft DirectPlay SDK
*Index  *Topic Contents
*Previous Topic: IDirectPlayLobby2 Interface
*Next Topic: IDirectPlayLobby2::CreateAddress


IDirectPlayLobby2::Connect


IDirectPlayLobby2 Interface

Connects an application to the session specified by the DPLCONNECTION structure currently stored with the DirectPlayLobby object.

Note This method will return an IDirectPlay2 or IDirectPlay2A interface. Use the standard COM QueryInterface method to obtain an IDirectPlay3 or IDirectPlay3A method.

HRESULT Connect(
  DWORD dwFlags,
  LPDIRECTPLAY2 *lplpDP,
  IUnknown FAR *pUnk
  );

Parameters
dwFlags
Reserved; must be zero.
lplpDP
Pointer to a pointer to be initialized with a valid interface—either IDirectPlay2 (if called on IDirectPlayLobby2) or IDirectPlay2A (if called on IDirectPlayLobby2A).
pUnk
Pointer to the containing IUnknown interface. This parameter is provided for future compatibility with COM aggregation features. Presently, however, IDirectPlayLobby2::Connect returns an error if this parameter is anything but NULL.
Return Values

Returns DP_OK if successful, or one of the following error values otherwise:

CLASS_E_NOAGGREGATION
DPERR_INVALIDFLAGS
DPERR_INVALIDINTERFACE
DPERR_INVALIDOBJECT
DPERR_INVALIDPARAMS
DPERR_NOTLOBBIED
DPERR_OUTOFMEMORY
Remarks

After this method is successfully completed, the application can skip the process of calling IDirectPlay3::InitializeConnection, IDirectPlay3::EnumSessions, and IDirectPlay3::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 IDirectPlayLobby2::GetConnectionSettings method. The application then can modify these settings and set them by using the IDirectPlayLobby2::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.

© 1998 Microsoft Corporation. All rights reserved. Terms of Use.

*Top of Page