IDirectPlay4::InitializeConnection

IDirectPlay4 Interface

Initializes a DirectPlay connection. All the information about the connection, including the service provider to use, the network address of the server, and the GUID of the session, is passed in through the lpConnection parameter.

Syntax

HRESULT InitializeConnection(
  LPVOID lpConnection,
  DWORD dwFlags
  );

Parameters

lpConnection
Pointer to a buffer that contains all the information about the connection to be initialized as a DirectPlay Address.
dwFlags
Not used. Must be zero.

Return Value

Returns DP_OK if successful, or one of the following error values otherwise:
DPERR_ALREADYINITIALIZED
DPERR_INVALIDFLAGS
DPERR_INVALIDPARAMS
DPERR_UNAVAILABLE

This method returns DPERR_ALREADYINITIALIZED if InitializeConnection has previously been called on this object. It returns DPERR_UNAVAILABLE if the service provider could not be initialized. This can be because the resources necessary to operate this service provider are not present (for example, TCP/IP stack not present).

Remarks

The lpConnection parameter supplied to this method can be obtained from the IDirectPlay4::EnumConnections method, or the application can create one directly using the IDirectPlayLobby3::CreateCompoundAddress method.

This method loads and initializes the appropriate service provider. The lpConnection parameter is passed on to the service provider, which extracts and saves any relevant information. This information is used when the IDirectPlay4::EnumSessions or IDirectPlay4::Open method is called so that the service provider does not pop up a dialog box asking for that information.

This method replaces DirectPlayCreate as the means of binding a service provider to a DirectPlay object. The primary benefits of InitializeConnection are that you can override the service provider dialogs, and you can initialize a lobby provider.

See Also

IDirectPlay4::EnumConnections, IDirectPlayLobby3::CreateCompoundAddress, DirectPlay Address


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