Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Microsoft C 6.0 - <b>_setvideomode() set screen display mode</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 _setvideomode()         Set screen display mode

 #include   <graph.h>

 short far _setvideomode( mode );
  short mode;       Desired video mode

    _setvideomode() selects a screen mode from those supported by a
    particular hardware/display configuration. You can select from the
    following manifest constants defined in graph.h:

       MODE           SIZE  (unit)      TYPE        COLOR         ADAPTER
    -------------   --------------   ----------   -------------   -------
    _TEXTBW40        40 x 25  char      text      16 grey         CGA
    _TEXTC40         40 x 25  char      text      16/8 color      CGA
    _TEXTBW80        80 x 25  char      text      16 grey         CGA
    _TEXTC80         80 x 25  char      text      16/8 color      CGA
    _MRES4COLOR     320 x 200 pixel   graphics    4 color         CGA
    _MRESNOCOLOR    320 x 200 pixel   graphics    4 grey          CGA
    _HRESBW         640 x 200 pixel   graphics    BW              CGA
    _TEXTMONO        80 x 25  char      text      BW              MDPA
    _MRES16COLOR    320 x 200 pixel   graphics    16 color        EGA
    _HRES16COLOR    640 x 200 pixel   graphics    16 color        EGA
    _ERESNOCOLOR    640 x 350 pixel   graphics    BW              EGA
    _ERESCOLOR      640 x 350 pixel   graphics    4 or 16 color   EGA
    _VRES2COLOR     640 x 480 pixel   graphics    BW              VGA*
    _VRES16COLOR    640 x 480 pixel   graphics    16 color        VGA
    _MRES256COLOR   320 x 200 pixel   graphics    256 color       VGA*
    _HERCMONO       720 x 348 pixel   graphics    BW              HGC
                 (or 80 x 25  char      text      BW -- use _TEXTMONO)
    _DEFAULTMODE      restore screen to original mode

 *and MCGA

       Returns:     If successful, _setvideomode() returns a nonzero
                    value. If unsuccessful it returns 0; an error will be
                    encountered if the hardware does not support the
                    selected mode.

         Notes:     The video mode must be set before calling any of the
                    graphics or text output routines.

                    Any of the Hercules adapters are supported, but only
                    in black and white. Before setting Hercules adapters
                    to graphics mode, the MSHERC.COM driver must be
                    loaded by typing 'MSHERC'. This driver is included
                    with the MSC compiler and Microsoft has given
                    permission to distribute it in commercial
                    applications without an explicit licensing agreement.

   Portability:     MS-DOS only, true MDPA, CGA, EGA, MCGA, or VGA video
                    compatibles

 -------------------------------- Example ---------------------------------

    This program sets the color graphics mode to the highest resolution
    supported by the hardware.

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

           main()
           {
              short return_val;
              struct videoconfig config;

              if ((return_val = _setvideomode( _VRES16COLOR )) == 0)
                 if ((return_val = _setvideomode( _HRES16COLOR )) == 0)
                    if ((return_val = _setvideomode( _MRES4COLOR )) == 0)
                       {
                       _setvideomode( _DEFAULTMODE );
                       printf("A color graphics adapter and display must be
           installed\n");
                       printf("in order to run this program. Press any key to
           return\n");
                       printf("to the operating system . . . \n");
                       while (!kbhit());
                       exit(1);
                       }
              _getvideoconfig(&config);

              . . . perform graphics routine . . .

              _setvideomode( _DEFAULTMODE );
           }


See Also: _getvideoconfig()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson