_getvideoconfig() Doesn't Return Pixel Info for Text Modes

ID: Q43914

5.10 6.00 6.00a 6.00ax 7.00 | 1.00 1.50

MS-DOS                      | WINDOWS
kbprg

The information in this article applies to:

In Microsoft C for MS-DOS, after a call to _getvideoconfig() from text modes, the structure videoconfig contains zero (0) for numxpixels, numypixels, and bitsperpixel. This is expected behavior because only the graphics modes return pixel information.

Both text and graphics modes return information about the number of text columns and rows. The sample code below demonstrates the absence of pixel information in text modes. The name of each text mode begins with "_TEXT."

The definition of the videoconfig structure and the arguments to _setvideomode() are contained in the include file GRAPH.H.

Sample Code

/* Compile options needed: none
*/ 

#include <stdio.h>
#include <graph.h>

struct videoconfig vc; /* Variable vc of type videoconfig */

/* Define an array of video modes and mode names
   because the numbers are not continuous */ 

int modes[12] = {_TEXTBW40, _TEXTC40, _TEXTBW80, _TEXTC80,
    _MRES4COLOR, _MRESNOCOLOR, _HRESBW, _TEXTMONO,
    _MRES16COLOR, _HRES16COLOR, _ERESNOCOLOR, _ERESCOLOR};

char *modenames[] = {"TEXTBW40", "TEXTC40", "TEXTBW80",
                      "TEXTC80", "MRES4COLOR", "MRESNOCOLOR",
                      "HRESBW", "TEXTMONO", "MRES16COLOR",
                      "HRES16COLOR", "ERESNOCOLOR", "ERESCOLOR"};

void main(void)
{

   int i;
   /* Test all video modes */ 
   for (i=0; i<= 11; i++) {
       _setvideomode (modes[i]);
       _getvideoconfig (&vc);
       printf ("\n video mode: \t%s\n",modenames[i]);
       printf (" x pixels: \t%d\n",vc.numxpixels);
       printf (" y pixels: \t%d\n",vc.numypixels);
       printf (" text columns: \t%d\n",vc.numtextcols);
       printf (" text rows: \t%d\n",vc.numtextrows);
       printf (" # of colors: \t%d\n",vc.numcolors);
       printf (" bits/pixel: \t%d\n",vc.bitsperpixel);
       printf (" video pages: \t%d\n",vc.numvideopages);
       printf (" Hit return for next video mode");
       getchar();
       _clearscreen (_GCLEARSCREEN);
   }
   _setvideomode (_DEFAULTMODE);
}

Additional reference words: kbinf 1.00 1.50 5.10 6.00 6.00a 6.00ax 7.00 KBCategory: kbprg KBSubcategory: CRTIss GraphicsIss Keywords : kb16bitonly

Last Reviewed: July 18, 1997