Platform SDK: DirectX

DirectDraw7.SetDisplayMode

The DirectDraw7.SetDisplayMode method sets the mode of the display-device hardware.

object.SetDisplayMode( _ 
    w As Long, _ 
    h As Long, _ 
    bpp As Long, _ 
    ref As Long, _ 
    mode As CONST_DDSDMFLAGS)

Parameters

object
Object expression that resolves to a DirectDraw7 object.
w and h
Width and height of the new mode.
bpp
Resolution, in bits per pixel (bpp), of the new mode.
ref
Refresh rate of the new mode. Set this value to 0 to request the default refresh rate for the driver.
mode
One of the constants from the CONST_DDSDMFLAGS enumeration describing additional options. Currently, the only valid flag is DDSDM_STANDARDVGAMODE, which causes the method to set Mode 13, instead of Mode X 320x200x8 mode. If you set another resolution, bit depth, or a Mode X mode, do not use this flag; set the parameter to 0.

Error Codes

If the method fails, it raises an error, and Err.Number can be set to one of the following values:

DDERR_GENERIC
DDERR_INVALIDMODE
DDERR_INVALIDOBJECT
DDERR_INVALIDPARAMS
DDERR_LOCKEDSURFACES
DDERR_NOEXCLUSIVEMODE
DDERR_SURFACEBUSY
DDERR_UNSUPPORTED
DDERR_UNSUPPORTEDMODE
DDERR_WASSTILLDRAWING

Remarks

This method must be called by the same thread that created the application window.

If another application changes the display mode, the primary surface is lost, and the method returns DDERR_SURFACELOST until the primary surface is recreated to match the new display mode.

See Also

DirectDraw7.RestoreDisplayMode, DirectDraw7.GetDisplayModesEnum, DirectDraw7.SetCooperativeLevel, Setting Display Modes, Restoring Display Modes