Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Watcom C/C++ v10.0 : C library - <b>synopsis:</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Synopsis:
    #include <graph.h>
    struct videoconfig _FAR * _FAR _getvideoconfig
        ( struct videoconfig _FAR *config );

Description:
    The _getvideoconfig function returns information about the current video
    mode and the hardware configuration.  The information is returned in the
    videoconfig structure indicated by the argument config.  The structure
    contains the following fields (all are short fields):

    numxpixels
        number of pixels in x-axis

    numypixels
        number of pixels in y-axis

    numtextcols
        number of text columns

    numtextrows
        number of text rows

    numcolors
        number of actual colors

    bitsperpixel
        number of bits in a pixel value

    numvideopages
        number of video pages

    mode
        current video mode

    adapter
        adapter type

    monitor
        monitor type

    memory
        number of kilobytes (1024 characters) of video memory

    The adapter field will contain one of the following values:

    _NODISPLAY
        no display adapter attached

    _UNKNOWN
        unknown adapter/monitor type

    _MDPA
        Monochrome Display/Printer Adapter

    _CGA
        Color Graphics Adapter

    _HERCULES
        Hercules Monochrome Adapter

    _MCGA
        Multi-Color Graphics Array

    _EGA
        Enhanced Graphics Adapter

    _VGA
        Video Graphics Array

    _SVGA
        SuperVGA Adapter

    The monitor field will contain one of the following values:

    _MONO
        regular monochrome

    _COLOR
        regular color

    _ENHANCED
        enhanced color

    _ANALOGMONO
        analog monochrome

    _ANALOGCOLOR
        analog color

    The amount of memory reported by _getvideoconfig will not always be
    correct for SuperVGA adapters.  Since it is not always possible to
    determine the amount of memory, _getvideoconfig will always report 256K,
    the minimum amount.

Returns:
    The _getvideoconfig function returns information about the current video
    mode and the hardware configuration.

See Also:
    _setvideomode, _setvideomoderows

Example:
    #include <conio.h>
    #include <graph.h>
    #include <stdio.h>
    #include <stdlib.h>

    main()
    {
        int mode;
        struct videoconfig vc;
        char buf[ 80 ];

        _getvideoconfig( &vc );
        /* select "best" video mode */
        switch( vc.adapter ) {
        case _VGA :
        case _SVGA :
            mode = _VRES16COLOR;
            break;
        case _MCGA :
            mode = _MRES256COLOR;
            break;
        case _EGA :
            if( vc.monitor == _MONO ) {
                mode = _ERESNOCOLOR;
            } else {
                mode = _ERESCOLOR;
            }
            break;
        case _CGA :
            mode = _MRES4COLOR;
            break;
        case _HERCULES :
            mode = _HERCMONO;
            break;
        default :
            puts( "No graphics adapter" );
            exit( 1 );
        }
        if( _setvideomode( mode ) ) {
            _getvideoconfig( &vc );
            sprintf( buf, "%d x %d x %d\n", vc.numxpixels,
                             vc.numypixels, vc.numcolors );
            _outtext( buf );
            getch();
            _setvideomode( _DEFAULTMODE );
        }
    }

Classification:
    PC Graphics

Systems:
    DOS, QNX

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