DirectPlayCreate

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 IDirectPlay3 interface directly rather than getting an IDirectPlay interface, having to use QueryInterface to access an IDirectPlay3 interface, and releasing the IDirectPlay interface.

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 IDirectPlay3::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 IDirectPlay3 or IDirectPlay3A interface pointer using the QueryInterface method.

HRESULT WINAPI DirectPlayCreate(
LPGUID lpGUIDSP,
LPDIRECTPLAY FAR *lplpDP,
IUnknown *lpUnk
);

Parameters

lpGUIDSP

Pointer to the GUID of the service provider that the DirectPlay object should be initialized with. Pass in a pointer to GUID_NULL to create an uninitialized DirectPlay object.

lplpDP

Pointer to an interface pointer to be initialized with a valid IDirectPlay interface. The application will need to use the QueryInterface method to obtain an IDirectPlay2, IDirectPlay3 (UNICODE strings) or IDirectPlay2A, IDirectPlay3A (ANSI strings) interface.

lpUnk

Pointer to the containing IUnknown. This parameter is provided for future compatibility with COM aggregation features. Presently, however, the DirectPlayCreate function 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_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.

Remarks

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 for DirectX 5 are IDirectPlay3 and IDirectPlay3A, which need to be obtained through a call to the QueryInterface method on the IDirectPlay interface returned by DirectPlayCreate.

See Also

IDirectPlay3::InitializeConnection, DirectPlayEnumerate