Microsoft DirectX 9.0

IDirectDraw::SetDisplayMode

The SetDisplayMode method sets the mode of the display device hardware. SetCooperativeLevel must be used to set exclusive level access before the mode can be changed. If other applications have created a DirectDrawSurface object on the Primary Surface and the mode is changed, those applications' Primary Surface objects will return DDERR_SURFACELOST until they are restored.

Syntax

HRESULT SetDisplayMode(
  DWORD dwWidth,
  DWORD dwHeight,
  DWORD dwBpp
  );

Parameters

dwWidth

Width of the new mode.

dwHeight

Height of the new mode.

dwBpp

Bits per pixel of the new mode.

Return Values

Value Description
DD_OK The method succeeded.
DDERR_INVALIDOBJECT DirectDraw received a pointer that was an invalid DirectDraw object.
DDERR_INVALIDPARAMS One or more of the input parameters is invalid.
DDERR_GENERIC Generic failure.
DDERR_UNSUPPORTED Action not supported.
DDERR_INVALIDMODE The display mode is not valid.
DDERR_LOCKEDSURFACES Operation could not be carried out because one or more surfaces are locked.
DDERR_WASSTILLDRAWING Informs DirectDraw that the previous Blt which is transfering information to or from this Surface is incomplete.
DDERR_SURFACEBUSY Access to this surface is being refused because the surface is already locked by another thread.
DDERR_NOEXCLUSIVEMODE Operation requires the application to have exclusive mode but the application does not have exclusive mode.

See Also