INF: Determining What Video Adapters Are Installed and Active

ID Number: Q38726

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

MS-DOS | OS/2

Summary:

In Microsoft C versions 5.1, 6.0, 6.0a, 6.0ax, and C/C++ version 7.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: 5.10 6.00 6.00a 6.00ax s_quickc display

monitor color monochrome mono black white b/w 7.00