The IDirectDraw4::SetDisplayMode method sets the mode of the display-device hardware.
HRESULT SetDisplayMode(
DWORD dwWidth,
DWORD dwHeight,
DWORD dwBPP,
DWORD dwRefreshRate,
DWORD dwFlags
);
If the method succeeds, the return value is DD_OK.
If the method fails, the return value may be one of the following error values:
DDERR_GENERIC |
DDERR_INVALIDMODE |
DDERR_INVALIDOBJECT |
DDERR_INVALIDPARAMS |
DDERR_LOCKEDSURFACES |
DDERR_NOEXCLUSIVEMODE |
DDERR_SURFACEBUSY |
DDERR_UNSUPPORTED |
DDERR_UNSUPPORTEDMODE |
DDERR_WASSTILLDRAWING |
This method must be called by the same thread that created the application window.
If another application changes the display mode, the primary surface will be lost and will return DDERR_SURFACELOST until it is recreated to match the new display mode.
As part of the IDirectDraw interface, this method did not include the dwRefreshRate and dwFlags parameters.
Windows NT/2000: Requires Windows 2000.
Windows 95/98: Requires Windows 95 or later. Available as a redistributable for Windows 95.
Header: Declared in ddraw.h.
Import Library: Use ddraw.lib.
IDirectDraw4::RestoreDisplayMode, IDirectDraw4::GetDisplayMode, IDirectDraw4::EnumDisplayModes, IDirectDraw4::SetCooperativeLevel, Setting Display Modes, Restoring Display Modes