A program that will run only on a single machine with a known graphics adapter can enter the appropriate video mode immediately. However, if you attempt to run the program on another machine with a different adapter, it may not run correctly, if at all.
If your program might run on a variety of computers and you prefer to select your own video modes, initialize a _videoconfig structure by calling the _getvideoconfig function. Then check the adapter member and use a switch statement to enter the selected video mode.
For example, suppose you know that a program will run on monochrome systems equipped with either an EGA adapter or a Hercules adapter. To enter the appropriate mode, use code such as this:
struct _videoconfig vc;
_getvideoconfig( &vc );
switch( vc.adapter )
{
case _EGA:
_setvideomode( _ERESNOCOLOR );
break;
case _HGC:
_setvideomode( _HERCMONO );
break;
}