Setting a Video Mode

The _setvideomode function turns on one of the 25 available video modes. Pass it a single integer that tells it which mode to display. The constants in Table 9.1 are defined in the GRAPH.H file. The dimensions are listed in pixels for video graphics mode and in columns for video text mode.

Table 9.1 Constants That Represent Video Modes

Constant (Name) Description Mode/Hardware

_MAXCOLORMODE Graphics mode with the most colors Graphics/All†
_MAXRESMODE Graphics mode with the highest resolution Graphics/All†
_DEFAULTMODE Restores the original mode All/All
_TEXTBW40 40 column text, 16 gray Text/CGA
_TEXTC40 40 column text, 16/8 color Text/CGA
_TEXTBW80 80 column text, 16 gray Text/CGA
_TEXTC80 80 column text, 16/8 color Text/CGA
_MRES4COLOR 320 ´ 200, 4 color Graphics/CGA
_MRESNOCOLOR 320 ´ 200, 4 gray Graphics/CGA
_HRESBW 640 ´ 200, BW Graphics/CGA
_TEXTMONO 80 column text, monochrome Text/MDPA
_HERCMONO* 720 ´ 348, monochrome Graphics/HGC
_MRES16COLOR 320 ´ 200, 16 color Graphics/EGA
_HRES16COLOR 640 ´ 200, 16 color Graphics/EGA
_ERESNOCOLOR 640 ´ 350, 4 monochrome Graphics/EGA
_ERESCOLOR 640 ´ 350, 4 or 16 color Graphics/EGA
_VRES2COLOR 640 ´ 480, BW Graphics/VGA
_VRES16COLOR 640 ´ 480, 16 color Graphics/VGA
_MRES256COLOR 320 ´ 200, 256 color Graphics/VGA
_ORESCOLOR 640 ´ 400, 1 of 16 colors Graphics/Olivetti
_ORES256COLOR 640 ´ 400, 256 colors Graphics/SVGA
_VRES256COLOR 640 ´ 480, 256 colors Graphics/SVGA
_SRES16COLOR1 800 ´ 600, 16 colors , Graphics/SVGA  
_SRES256COLOR1 800 ´ 600, 256 colors Graphics/SVGA
_XRES16COLOR2 1024 ´ 768, 16 colors , Graphics/SVGA  
_XRES256COLOR2 1024 ´ 768, 256 colors Graphics/SVGA
_ZRES16COLOR3 1280 ´ 1024, 16 colors Graphics/SVGA
_ZRES256COLOR3 1280 ´ 1024, 256 colors Graphics/SVGA

* Before attempting to enter _HERCMONO mode, you must install the terminate-and-stay-resident program MSHERC.COM, which comes in the Microsoft C/C++ package. If you have both a Hercules adapter and an additional graphics adapter in the same computer, use the /H option to put the Hercules into HALF mode to avoid unpredictable and undesirable results.

_MAXRESMODE and _MAXCOLORMODE support all adapters except the MDPA. These constants never select _SRES, _XRES, or _ZRES modes. See “Maximizing Resolution or Color,” for definitions of these two modes.

1 Requires NEC MultiSync 3D, equivalent, or better.

2 Requires NEC MultiSync 4D, equivalent, or better.

3 Requires NEC MultiSync 5D, equivalent, or better.

If the hardware does not support the selected mode, _setvideomode returns 0.

Warning:

Do not attempt to use any of the _SRES, _XRES, or _ZRES modes unless your display monitor supports them. Otherwise, you risk damaging your display monitor. Micrososft assumes no responsibility for damage to video monitors resulting from use of this software. Consult your owner's manual for details.

Some graphics adapters are able to enter additional video modes:

EGA adapters can display all CGA modes and _TEXTMONO.

HGC adapters can enter _TEXTMONO mode.

MCGA adapters can display all CGA modes, plus _VRES2COLOR and _MRES256COLOR.

VGA adapters can display all EGA modes.

SVGA adapters can display all VGA modes. SVGA adapters may also support nonstandard modes that conform to the limitations listed in “Limitations of VESA Support”.