DirectDrawCreate function (ddraw.h)

Creates an instance of a DirectDraw object. A DirectDraw object that is created by using this function does not support the complete set of Direct3D interfaces in DirectX 7.0. To create a DirectDraw object that is capable of exposing all of the features of Direct3D in DirectX 7.0, use the DirectDrawCreateEx function.

Syntax

HRESULT DirectDrawCreate(
  [in]  GUID         *lpGUID,
  [out] LPDIRECTDRAW *lplpDD,
  [in]  IUnknown     *pUnkOuter
);

Parameters

[in] lpGUID

A pointer to the globally unique identifier (GUID) that represents the driver to be created. This can be NULL to indicate the active display driver, or you can pass one of the following flags to restrict the active display driver's behavior for debugging purposes:

DDCREATE_EMULATIONONLY

The DirectDraw object uses emulation for all features; it does not take advantage of any hardware-supported features.

DDCREATE_HARDWAREONLY

The DirectDraw object never emulates features not supported by the hardware. Attempts to call methods that require unsupported features fail, returning DDERR_UNSUPPORTED.

[out] lplpDD

A pointer to a variable to be set to a valid IDirectDraw interface pointer if the call succeeds.

[in] pUnkOuter

Allows for future compatibility with COM aggregation features. Presently, however, this function returns an error if this parameter is anything but NULL.

Return value

If the function succeeds, the return value is DD_OK.

If it fails, the function can return one of the following error values:

  • DDERR_DIRECTDRAWALREADYCREATED
  • DDERR_GENERIC
  • DDERR_INVALIDDIRECTDRAWGUID
  • DDERR_INVALIDPARAMS
  • DDERR_NODIRECTDRAWHW
  • DDERR_OUTOFMEMORY

Remarks

This function attempts to initialize a DirectDraw object, and then sets a pointer to the object if the call succeeds.

On computers with multiple monitors, if you specify NULL for lpGUID, the DirectDraw object runs in emulation mode when the normal cooperative level is set. To make use of hardware acceleration on these computers, specify the device's GUID.

You must use LoadLibrary to explicitly link to Ddraw.dll and then use GetProcAddress to access the DirectDrawCreate function.

Requirements

Requirement Value
Target Platform Windows
Header ddraw.h
Library Ddraw.lib
DLL Ddraw.dll