IDirectPlay3::InitializeConnection

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.

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 Values

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 IDirectPlay3::EnumConnections method, or the application can create one directly using the IDirectPlayLobby2::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 IDirectPlay3::EnumSessions or IDirectPlay3::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

IDirectPlay3::EnumConnections, IDirectPlayLobby2::CreateCompoundAddress, DirectPlay Address