Platform SDK: DirectX |
The IDirectPlay4::InitializeConnection method 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 );
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).
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.
Windows NT/2000: Requires Windows 2000.
Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
Header: Declared in dplay.h.
Import Library: Use dplayx.lib.
IDirectPlay4::EnumConnections, IDirectPlayLobby3::CreateCompoundAddress, DirectPlay Address