DirectX SDK |
This function is obsolete and remains for compatibility with applications written using DirectX 3. It is recommended that applications create the desired DirectPlay interface directly using CoCreateInstance. By using CoCreateInstance you can obtain an IDirectPlay4 interface directly rather than getting an IDirectPlay interface, having to use QueryInterface to access an IDirectPlay4 interface, and releasing the IDirectPlay interface.
The DirectPlayCreate function creates a new DirectPlay object and obtains an IDirectPlay interface pointer. If the application supplies GUID_NULL for the lpGUIDSP parameter, this function creates a DirectPlay object but does not initialize a service provider. The application can then call the IDirectPlay4::InitializeConnection method to initialize the service provider or lobby provider.
The application can supply a service provider GUID (see DirectPlayEnumerate) to indicate which service provider to bind.
In order to use the latest DirectPlay functionality, the application must obtain an IDirectPlay4 or IDirectPlay4A interface pointer using the QueryInterface method.
HRESULT WINAPI DirectPlayCreate( LPGUID lpGUIDSP, LPDIRECTPLAY FAR *lplpDP, IUnknown *lpUnk );
Returns DP_OK if successful, or one of the following error values otherwise:
CLASS_E_NOAGGREGATION |
DPERR_EXCEPTION |
DPERR_INVALIDPARAMS |
DPERR_UNAVAILABLE |
DPERR_UNAVAILABLE is returned if a DirectPlay object could not be created. DPERR_INVALIDPARAMS is returned if the GUID provided is invalid.
This function attempts to initialize a DirectPlay object and sets a pointer to it if successful. Your application should call the DirectPlayEnumerate function immediately before initialization to determine what types of service providers are available (the DirectPlayEnumerate function fills in the lpGUIDSP parameter of DirectPlayCreate).
This function returns a pointer to an IDirectPlay interface. The current interfaces are IDirectPlay4 and IDirectPlay4A, which need to be obtained through a call to the QueryInterface method on this IDirectPlay interface. For more information, see Overview of DirectPlay Interfaces.
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.