Determining What Video Adapters Are Installed and Active

ID: Q38726

5.10 6.00 6.00a 6.00ax 7.00 | 5.10 6.00 6.00a | 1.00

MS-DOS                      | OS/2            | WINDOWS
kbprg

The information in this article applies to:

SUMMARY

In Microsoft C versions 5.1, 6.0, 6.0a, 6.0ax, C/C++ version 7.0, and Visual C++ version 1.0 there is no way using the functions supplied in the C run-time library to find out what type of video adapters are installed in your system. However, in the appendix of the "Programmer's Guide to PC & PS/2 Video Systems," published by Microsoft Press, is a MASM example demonstrating how to determine what adapters are installed. (This example could be translated into C.)

MORE INFORMATION

Even if you write code to find out what adapters are installed, there is no simple way to tell the graphics library to use an adapter other than the one it wants to use. The library will pick an adapter according to the following rules:

1. If there is a VGA in the system, it uses it regardless of what

   other adapters are installed and regardless of what adapter is
   currently the default adapter. The only way to change this is to
   hook the BIOS INT 10h interrupt as described below.

2. If there is no VGA, it uses the current adapter. This can be set
   with the MODE command in MS-DOS before you start your program.

If you hook INT 10h, you can change the behavior with the VGA to pick the current adapter. The _setvideomode() function makes a call to INT 10h function 1Bh to determine whether a VGA is installed or not. You can write code to change the return value if the VGA is not the current adapter, leaving it alone if the VGA is the current adapter.

The _getvideoconfig() function only gives information on the current video mode, as set by _setvideomode(). It is not helpful for finding out what adapters are installed in your system.

You can find out what adapter the library will use by making calls to _setvideomode(). If the mode cannot be selected, _setvideomode() will return zero. For example, if you try to select a VGA mode and _setvideomode returns zero, you know that no VGA is present in the system. You then could attempt to select an EGA, and so on.

Additional reference words: kbinf 1.00 5.10 6.00 6.00a 6.00ax 7.00 display monitor color monochrome mono black white b/w KBCategory: kbprg KBSubcategory: CRTIss GraphicsIss Keywords : kb16bitonly

Last Reviewed: July 18, 1997