Windows Display Drivers

The number of colors a Windows program can display simultaneously is determined by the user's video hardware and the Windows display driver. The video hardware, namely the video card and monitor, generally support many different resolutions and color depths (each resolution and color depth combination is called a video mode). Display drivers for some or all of these video modes are shipped with Windows itself, or are provided separately by the video card manufacturer. For example, Windows 95 uses a 16-color 640x480 display driver by default, but users can install a video driver with a higher resolution or greater color depth through the Windows "Display Settings" icon from the Control Panel.

Today, video hardware capable of palette-based 256-color (eight bits per pixel) resolutions can be considered the absolute minimum equipment for Windows, with 32K/64K high color (15/16 bits per pixel) and 16.7M true color (24/32 bits per pixel) equipment considered standard. Despite these increased color depths, it's still not unusual for end users to have a 16-color display driver in use, typically because they continue to use the default Windows display driver.

16-color display drivers are fine for some types of applications, but for games, educational software, and imaging products, a minimum 256-color display driver is almost essential. The fg_colors() function returns the display driver's color depth in bits per pixel (for example, fg_colors() returns 8 if the display driver supports 256 colors). For example, the code shown here prevents an application from running unless the user's display driver supports at least 256 colors.


if (fg_colors() < 8)
   MessageBox(hWnd,"256-color driver required","Error",
   return 0;


if (fg_colors() < 8)
   MessageDlg("256-color driver required",mtError,


if fg_colors < 8 then
  MessageDlg('256-color driver required',mtError,[mbOK],0);

Visual Basic:

If fg_colors() < 8 Then
   Call MsgBox("256-color driver required", vbCritical, "Error")
   Unload Me
   Exit Sub
End If

<< Prev

Next >>

Fastgraph Home Page


copyright 2001 Ted Gruber Software, Inc.