HRESULT SetDisplayMode(DWORD dwWidth, DWORD dwHeight,
DWORD dwBPP, DWORD dwRefreshRate, DWORD dwFlags);
Sets the mode of the display device hardware.
·Returns DD_OK if successful, or one of the following error values otherwise:
DDERR_GENERIC | DDERR_INVALIDMODE |
DDERR_INVALIDOBJECT | DDERR_INVALIDPARAMS |
DDERR_LOCKEDSURFACES | DDERR_NOEXCLUSIVEMODE |
DDERR_SURFACEBUSY | DDERR_UNSUPPORTED |
DDERR_UNSUPPORTEDMODE | DDERR_WASSTILLDRAWING |
dwWidth
Specifies the width of the new mode.
dwHeight
Specifies the height of the new mode.
dwBPP
Specifies the bits per pixel of the new mode.
dwRefreshRate
Specifies the refresh rate of the new mode. If this parameter is set to 0, the IDirectDraw interface version of this method is used.
dwFlags
This parameter is not currently used and must be set to 0.
The IDirectDraw::SetCooperativeLevel method 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.
To ensure COM compliance, this method is not part of the IDirectDraw interface, but belongs to the IDirectDraw2 interface. To use this method, you must first query for the IDirectDraw2 interface. For more information, see IDirectDraw2 Interface.