Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
setvideomode
◄Summary► ◄Example► ◄Up► ◄Contents► ◄Index► ◄Back►
────────────────────────────────────────────────────────────────────────────
The setvideomode function selects a screen mode appropriate for a
particular hardware/display configuration. The <mode> argument can
be one of the symbolic constants shown below and defined in
FGRAPH.FD.
Note that in OS/2, only text video modes may be selected by
setvideomode.
Symbolic Constants for Screen Mode
Mode Type Size Colors Adapter
$DEFAULTMODE Hardware default mode
$MAXRESMODE Highest resolution graphics mode
$MAXCOLORMODE Maximum colors graphics mode
$TEXTBW40 M/T 40x25 16 CGA
$TEXTC40 C/T 40x25 16 CGA
$TEXTBW80 M/T 80x25 16 CGA
$TEXTC80 C/T 80x25 16 CGA
$MRES4COLOR C/G 320x200 4 CGA
$MRESNOCOLOR M/G 320x200 4 CGA
$HRESBW M/G 640x200 2 CGA
$TEXTMONO M/T 80x25 1 MA
$HERCMONO Hercules 720x348 1 HGC
graphics
$MRES16COLOR C/G 320x200 16 EGA
$HRES16COLOR C/G 640x200 16 EGA
$ERESNOCOLOR M/G 640x350 1 EGA
$ERESCOLOR C/G 640x350 16 EGA
$VRES2COLOR C/G 640x480 2 VGA
$VRES16COLOR C/G 640x480 16 VGA
$MRES256COLOR C/G 320x200 256 VGA
$ORESCOLOR C/G 640x400 1 of 16 Olivetti
graphics
Type: M indicates monochrome. C indicates color output. T
indicates text. G indicates graphics.
Size: For text modes, size is given in characters (column
multiplied by rows). For graphics modes, size is given in
pixels (horizontal multiplied by vertical).
Colors: For monochrome displays, the number of colors is the
number of grey shades.
Adapter: Adapters are the IBM (and compatible) Monochrome Adapter
(MDPA), Color Graphics Adapter (CGA), Enhanced Graphics
Adapter (EGA), Video Graphics Array (VGA), Hercules-
compatible adapter, and Olivetti-compatible adapter.
Note that only standard hardware is described here, but display
hardware that is strictly compatible with IBM, Hercules, or
Olivetti hardware should also work as described.
The two special modes $MAXRESMODE and $MAXCOLORMODE select the
highest resolution and most colorful video mode available with the
current hardware, respectively. These two modes fail for adapters
that do not support graphics modes.
Listed below are the video modes selected for different adapter and
monitor combinations when $MAXRESMODE or $MAXCOLORMODE is
specified:
Adapter/Monitor $MAXRESMODE $MAXCOLORMODE
MDPA fail fail
HGC $HERCMONO $HERCMONO
CGA color $HRESBW $MRES4COLOR
CGA noncolor $HRESBW $MRESNOCOLOR
OCGA $ORESCOLOR $MRES4COLOR
OEGA color $ORESCOLOR $ERESCOLOR
EGA color 256k $HRES16COLOR $HRES16COLOR
EGA color 64k $HRES16COLOR $HRES16COLOR
EGA ecd 256k $ERESCOLOR $ERESCOLOR
EGA ecd 64k $ERESCOLOR $HRES16COLOR
EGA mono $ERESNOCOLOR $ERESNOCOLOR
MCGA $VRES2COLOR $MRES256COLOR
VGA $VRES16COLOR $MRES256COLOR
OVGA $VRES16COLOR $MRES256COLOR
Note that a color monitor is assumed for CGA adapters if the
startup text mode was TEXTC80 or TEXTC40. If the initial text mode
is TEXTBW80 or TEXTBW40, a noncolor CGA monitor is assumed.
Hercules Support
In $HERCMONO mode, only monochrome (two-color) text and graphics
are supported. The screen resolution is 720 x 348 pixels. The text
dimensions are 80 columns by 25 rows, with a 9 x 14 character box.
The bottom two scan lines of the twenty-fifth row are not visible.
You must install the Hercules driver MSHERC.COM before running your
program. Type MSHERC to load the driver. This can be done from an
AUTOEXEC.BAT file.
If you have both a Hercules monochrome card and a color video card,
you should install MSHERC.COM with the /H (/HALF) option. The /H
option causes the driver to use one instead of two graphics pages.
This prevents the two video cards from attempting to use the same
memory. You do not have to use the /H option if you have only a
Hercules card. See your Hercules hardware manuals for more details
of compatibility.
To use a mouse, you must follow special instructions for Hercules
cards in the "Microsoft Mouse Programmer's Reference Guide". (This
must be ordered separately; it is not supplied with either
Microsoft C or the mouse package.)
Return Value
The function returns the number of text rows if successful. If an
error occurs (that is, the mode selected is not supported by the
current hardware configuration), the function returns 0.
-♦-