graphics.hlp (
Topic list)
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 manifest constants shown below and defined in
GRAPH.H.
Note that in OS/2, only text video modes may be selected by
_setvideomode.
Manifest 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 the function is
successful. If an error is encountered (that is, the mode selected
is not supported by the current hardware configuration), the
function returns 0.
-♦-