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 IDirectPlay4 interface directly rather than getting an IDirectPlay interface, having to use QueryInterface to access an IDirectPlay4 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 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.
Syntax
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, IDirectPlay4 Interface (UNICODE strings) or IDirectPlay2A, IDirectPlay4A (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 Value
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 6 are IDirectPlay4 and IDirectPlay4A, which need to be obtained through a call to the QueryInterface method on the IDirectPlay interface returned by DirectPlayCreate.
See Also
Top of Page
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.