![]() On single-monitor systems, you can assume the point 0,0 to be in the upper-left, and SM_CXSCREEN, SM_CYSCREEN to be in the lower-right. GetSystemMetrics provides the easiest way to retrieve the entire desktop surface coordinates. On systems that don't support this request (there's that pesky Windows 95 again), you'll get back 0, so the best strategy is to test for >1 to quickly determine your ensuing strategy. To determine the number of monitors present, you need only call that API, asking for SM_CMONITORS. The GetSystemMetrics API call has been expanded over the years to include new built-in functionality as it increases. So, why not get right to that first? Multiple-monitor support wasn't offered until Windows 98 and Windows 2000, so if you're still supporting Windows 95 and/or NT4 you'll always need to code at least two solutions for every situation you intend to address. Knowing the entire desktop coordinates can also be extremely useful if you just want to cover the whole thing with a single form. In order to do this, or tasks such as the writer above describes, you need to be able to determine how many monitors there are and the screen coordinates of each. One of my screensavers shows the same image on all monitors, while another shows different images on each monitor. You've probably seen similar applications. I've also created applications (OK, a screensaver or three) that needed to cover the entire desktop, all visible monitors included. In addition, I need to know if PowerPoint is on screen one, two or three. I am writing a VBA program and need to determine the screen resolution of all the monitors in a 3-screen system. For instance, I recently saw a newsgroup post that read in part: Multiple monitor setups are becoming increasingly common, and there are occasions where you'll want to react differently based on which monitor the user places your application's windows, or even where you'll want to make sure your application is using specific monitor(s). Most of the time it doesn't matter where the user puts your application's windows, but every now and then you really need to know - or even decide this for yourself. ![]() Classic VB Corner Working with Multiple Monitors
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |