Changing the Display Settings

You can create full screen programs with Fastgraph's native or DirectX libraries. For native programs, the fg_modeset() and fg_modetest() functions provide the ability to change the display resolution without using DirectX.

The fg_modeset() function dynamically defines the display settings. The first three fg_modeset() parameters specify the display's new horizontal resolution, vertical resolution, and color depth in bits per pixel (8, 16, 24, or 32). The fourth parameter indicates whether the Windows taskbar will be visible (0) or hidden (any other value). When using fg_modeset() in Visual Basic programs, you must also make the ShowInTaskbar property have the same visibility state as the fg_modeset() taskbar visibility parameter.

Some Windows display drivers require the color depth parameter to be the same as the display's current color depth, so you'll generally pass the fg_colors() return value as the fg_modeset() color depth. For example, here's how you would use fg_modeset() to change the display resolution to 640x480 pixels, with the taskbar hidden:

C/C++:

fg_modeset(640,480,fg_colors(),1);

Delphi:

fg_modeset(640,480,fg_colors,1);

Visual Basic:

Call fg_modeset(640, 480, fg_colors(), 1)

The fg_modeset() function returns 0 if the mode change was successful, 1 if Windows must be restarted before the new mode takes effect, or a negative value if the mode change failed. You cannot call fg_modeset() until your program's main window is initially displayed. Further, we recommend that programs that change the display mode with fg_modeset() do so before setting up the logical palette, as some Windows display drivers redefine the palette values when changing display modes.

Any program that calls fg_modeset() should restore the original display settings before exiting. The easiest way to do this is calling fg_modeset() with the color depth parameter set to zero. In this case, fg_modeset() ignores the other parameters and restores the default display resolution and color depth defined in the Windows registry.

A related function, fg_modetest(), checks if the user's system supports a given display resolution and color depth combination. Its three parameters are the same as the first three fg_modeset() parameters. The fg_modetest() function returns 0 if the requested mode is available, 1 if the mode is available but Windows must first be restarted before it takes effect, or a negative value if the requested mode is not available. As with fg_modeset(), you cannot call fg_modetest() until your program's main window is initially displayed.

<< Prev

Next >>

Contents
Fastgraph Home Page

 

copyright 2001 Ted Gruber Software, Inc.