Microsoft KB Archive/43914

{|
 * width="100%"|

_getvideoconfig Doesn't Return Pixel Info for Text Modes

 * }

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: - The C Run-time (CRT), included with: - Microsoft C for MS-DOS, versions 5.1, 6.0, 6.0a, and 6.0ax - Microsoft C/C++ for MS-DOS, versions 7.0 - Microsoft Visual C++ for Windows, versions 1.0 and 1.5 -- 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 &quot;_TEXT.&quot; 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 #include 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[] = {&quot;TEXTBW40&quot;, &quot;TEXTC40&quot;, &quot;TEXTBW80&quot;, &quot;TEXTC80&quot;, &quot;MRES4COLOR&quot;, &quot;MRESNOCOLOR&quot;, &quot;HRESBW&quot;, &quot;TEXTMONO&quot;, &quot;MRES16COLOR&quot;, &quot;HRES16COLOR&quot;, &quot;ERESNOCOLOR&quot;, &quot;ERESCOLOR&quot;}; void main(void) { int i; /* Test all video modes */ for (i=0; i<= 11; i++) { _setvideomode (modes[i]); _getvideoconfig (&vc); printf (&quot;\n video mode: \t%s\n&quot;,modenames[i]); printf (&quot; x pixels: \t%d\n&quot;,vc.numxpixels); printf (&quot; y pixels: \t%d\n&quot;,vc.numypixels); printf (&quot; text columns: \t%d\n&quot;,vc.numtextcols); printf (&quot; text rows: \t%d\n&quot;,vc.numtextrows); printf (&quot; # of colors: \t%d\n&quot;,vc.numcolors); printf (&quot; bits/pixel: \t%d\n&quot;,vc.bitsperpixel); printf (&quot; video pages: \t%d\n&quot;,vc.numvideopages); printf (&quot; Hit return for next video mode&quot;); 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

Issue type :

Technology : kbVCsearch kbAudDeveloper kbCRT