_getvideoconfig

Description

Gets graphics video configuration information.

#include <graph.h>

struct _videoconfig __far * __far _getvideoconfig( struct _videoconfig
__far *config );

config Configuration information  

Remarks

The _getvideoconfig function returns the current graphics environment configuration in a _videoconfig structure, defined in GRAPH.H.

The values returned reflect the currently active video adapter and monitor, as well as the current video mode.

The _videoconfig structure contains the following members, each of which is of type short:

Member Contents

numxpixels Number of pixels on the x axis
numypixels Number of pixels on the y axis
numtextcols Number of text columns available
numtextrows Number of text rows available
numcolors Number of color indices
bitsperpixel Number of bits per pixel
numvideopages Number of available video pages
adapter Active display adapter
mode Current video mode
monitor Active display monitor
memory Adapter video memory in kilobytes

The values for the adapter member of the _videoconfig structure are given by the manifest constants shown in the list below. For any applicable adapter (_CGA, _EGA, or _VGA), the corresponding Olivetti adapter (_OCGA, _OEGA, or _OVGA) represents a superset of graphics capabilities.

Adapter Constant Meaning

_CGA Color Graphics Adapter
_EGA Enhanced Graphics Adapter
_HGC Hercules Graphics Card
_MCGA Multicolor Graphics Array
_MDPA Monochrome Display Printer Adapter
_OCGA Olivetti (AT&T) Color Graphics Adapter
_OEGA Olivetti (AT&T) Enhanced Graphics Adapter
_OVGA Olivetti (AT&T) Video Graphics Array
_VGA Video Graphics Array
_SVGA Super Video Graphics Array (VESA)

The values for the monitor member of the _videoconfig structure are given by the manifest constants listed below:

Monitor Constant Meaning

_ANALOG Analog monochrome and color
_ANALOGCOLOR Analog color only
_ANALOGMONO Analog monochrome only
_COLOR Color (or enhanced monitor emulating a color monitor)
_ENHCOLOR Enhanced color
_MONO Monochrome monitor

In every text mode, including monochrome, the _getvideoconfig function returns the value 32 for the number of available colors. The value 32 indicates the range of values (0–31) accepted by the _settextcolor function. This includes 16 normal colors (0–15) and 16 blinking colors (16–31). Blinking is selected by adding 16 to the normal color index. Because monochrome text mode has fewer unique display attributes, some color indices are redundant. However, because blinking is selected in the same manner, monochrome text mode has the same range (0–31) as other text modes.

Return Value

The _getvideoconfig function returns the video configuration information in a structure, as noted above. There is no error return.

Compatibility

Standards:None

16-Bit:DOS

32-Bit:None

See Also

_setvideomode, _setvideomoderows

Example

/* GVIDCFG.C: This program displays information about the current

* video configuration.

*/

#include <stdio.h>

#include <graph.h>

void main( void )

{

struct _videoconfig vc;

short c;

char b[500]; /* Buffer for string */

_getvideoconfig( &vc );

/* Write all information to a string, then output string. */

c = sprintf( b, "X pixels: %d\n", vc.numxpixels );

c += sprintf( b + c, "Y pixels: %d\n", vc.numypixels );

c += sprintf( b + c, "Text columns: %d\n", vc.numtextcols );

c += sprintf( b + c, "Text rows: %d\n", vc.numtextrows );

c += sprintf( b + c, "Colors: %d\n", vc.numcolors );

c += sprintf( b + c, "Bits/pixel: %d\n", vc.bitsperpixel );

c += sprintf( b + c, "Video pages: %d\n", vc.numvideopages );

c += sprintf( b + c, "Mode: %d\n", vc.mode );

c += sprintf( b + c, "Adapter: %d\n", vc.adapter );

c += sprintf( b + c, "Monitor: %d\n", vc.monitor );

c += sprintf( b + c, "Memory: %d\n", vc.memory );

_outtext( b );

}

Output

X pixels: 0

Y pixels: 0

Text columns: 80

Text rows: 25

Colors: 32

Bits/pixel: 0

Video pages: 1

Mode: 3

Adapter: 8

Monitor: 24

Memory: 256