baSetDisplay sets the screen size and depth.


Windows and Macintosh


Result = baSetDisplay( Width , Height , Depth , Mode , Force )


Integer, integer, integer, string, integer.
Width is the new width of the screen in pixels.
Height is the new height of the screen in pixels.
Depth is the new depth of the screen in bits.
Mode is the way in which the new display is set. On Windows, can be:


temporarily change the display settings.


permanently change the display settings.


tests whether the display can be set without restarting.

Mode is ignored on Macintosh.

If Force is true, forces the display to change. Ignored on Macintosh.


Returns 0 if the display was changed or can be changed without restarting.
Returns 1 if Windows will need to be restarted for the change to take effect.
Returns less than 0 if another error occurred, eg invalid screen size.


OK = baSetDisplay( 640 , 480 , 8 , "temp" , false )

OK := baSetDisplay( 640 , 480 , 8 , "temp" , false )


Not all display cards and drivers support screen changing without restarting.

The force option is not officially supported by Microsoft. It forces the display to change without restarting. This may work correctly with some video cards and drivers, but can cause palette problems on others, and crash the system on some. You are advised to only use this option on known hardware and after extensive testing.

If you use the "temp" mode, then the user's preferred screen display will be returned when the system is restarted. You can not set a "temp" mode unless it can be changed without restarting Windows.

The "temp" mode should only be used if you do not intend the user to be able to access the task bar or desktop while your program is running. When using the "temp" mode, Windows may not position the desktop icons and task bar in usable positions.

You are encouraged to use the newer MultiDisplay functions instead of this one.

See also: