The information in this article applies to:
SUMMARY
Multimon.exe is a sample project that shows how to detect and handle
multiple monitors on Windows 98.
MORE INFORMATIONThe following files are available for download from the Microsoft
Download Center. Click the file names below to download the files: Multimon.exeRelease Date: OCT-21-1998 For more information about how to download files from the Microsoft Download Center, please visit the Download Center at the following Web address http://www.microsoft.com/downloads/search.aspand then click How to use the Microsoft Download Center.
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 DesktopThe 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 backward 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 that the tops aligned. The second monitor's 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 MonitorsLike 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, or displaying Help.Multiple Monitors and the ProgrammerIn 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:
The form will still be centered, but on the primary monitor, which may not necessarily be the same monitor that the application is 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 APIsThere are new APIs for handling multiple monitors in Windows 98. The APIs 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.
Known IssuesIn Visual Basic 5.0:
The Multimon.exe SampleThe multimon.exe sample project shows how to use the clsMonitors class. The sample class includes the following items:Collections: Monitors Properties: DeskTopLeft Methods: GetMonitorFromWindow The code provided in the sample project is extensively commented. Following these comments through the code should give the programmer a full understanding of how the class works. NOTE: The sample is saved as a Visual Basic 4.0 project. If the project is opened in Visual Basic 5.0 or 6.0, you will be prompted to save it in an updated format. Additional query words: kbDSupport kbdss kbVBp kbCodeSam kbSample kbVBp400 kbVBp500 kbVBp600
Keywords : kbfile kbGrpVB |
Last Reviewed: January 5, 2000 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |