Windows 98 has a new feature that allows up to nine monitors to be used at the same time. The use of multiple video cards and multiple monitors creates a virtual desktop that increases the display area for the user.
Applications can be displayed on any monitor, dragged seamlessly from one monitor to another, or span the virtual desktop so the application can be seen on more than one monitor. Each monitor can be set at any resolution or color depth independent of other monitors. There is also the ability to use the additional monitors to display the same information as the primary monitor.
The Virtual Desktop
The desktop of a single monitor system is only the size of the monitor's resolution. The virtual desktop that is created when multiple monitors are utilized is somewhat different. The primary monitor will always have compatible coordinates of 0,0 for the upper left, and the x and y resolution of the display for the lower right corner. This provides backwards compatibility for legacy applications. Other monitors connected to the system will have coordinates relative to the primary monitor and the monitor's screen size.
For example, if the primary monitor is set to 1024x768, it will have coordinates of 0,0 to 1024,768. The second monitor is attached and set to 640x480 and the settings specify that this second monitor is to the right of the primary monitor and the tops aligned. The second monitors coordinates would be 1025,0 for the upper left corner and 1664,480 for the lower right corner.
If the second monitor was specified as being to the left or above the primary monitor, the coordinates would include negative values.
Uses of Multiple Monitors
Like the primary monitor, the use of the display area is limited only by the imagination of the programmer. However, several new uses of the addition screen real estate might include using the second monitor for a preview window, a debugging window and displaying help.
Multiple Monitors and the Programmer
In previous systems, negative screen coordinates were often assumed to be off the screen. On a multiple monitor system, the negative screen coordinates might be right in the middle of another visible screen (monitor). Other things that are impacted with multiple monitors are the centering of forms, the size of forms, color depth of the screen(s) and the saving of form locations.
The programmer can no longer reliably use the following code to center a form:
Me.Move (Screen.Width - Width) \ 2, (Screen.Height - Height) \ 2
The form will still be centered, but on the primary monitor, which may not necessarily be the same monitor that the application was running on. If the user does not see the form on the primary monitor and the form is modal, the application may appear to be non-responsive.
Programmers may also have code that limits a form resize to the size of the screen. Such code would make it impossible for a user to size the form so that it spanned multiple monitors. (This is really handy when displaying spreadsheet data.)
Programmers may have code that determines the color depth of the screen and display a splash screen with a bitmap of that color depth. The problem here is that the primary display may have 256 colors, but the second display may only have 16.
Another example is when the programmer saves the form position for the next application session. After this is done the user might disable multiple monitors. The next time the application is run it might display entirely off the screen, resulting in an 'invisible' application.
The New API's
There are new API's for handling multiple monitors in Windows 98. The API's used in the monitors class sample are GetMonitorInfo, MonitorFromWindow and MonitorFromRect.
The GetSystemMetrics API has some new constants (see below) that can be used to determine the metrics of a multiple monitor system. The GetSystemMetrics API returns information about the Windows environment. This API can be used to determine how many monitors are on the system, whether they are set at the same display format, and the size of the virtual desktop.
'Virtual Desktop sizes Const SM_XVIRTUALSCREEN = 76 'Virtual Left Const SM_YVIRTUALSCREEN = 77 'Virtual Top Const SM_CXVIRTUALSCREEN = 78 'Virtual Width Const SM_CYVIRTUALSCREEN = 79 'Virtual Height Const SM_CMONITORS = 80 'Get number of monitors Const SM_SAMEDISPLAYFORMAT = 81
Taken from the Microsoft KB article 194578