Extended Desktop Dimensions

This is a discussion on Extended Desktop Dimensions within the Windows Programming forums, part of the Platform Specific Boards category; So, I'm working on a basic screensaver framework and I'm having trouble with multiple monitor support. Currently, I just create ...

  1. #1
    Work in Progress..... Jaken Veina's Avatar
    Join Date
    Mar 2005
    Location
    Missouri. Go Imos Pizza!
    Posts
    256

    Extended Desktop Dimensions

    So, I'm working on a basic screensaver framework and I'm having trouble with multiple monitor support. Currently, I just create a window whose client area covers the entire screen and contain the saver within it, and I'd really like to keep that structure. I figure I can have the program detect if the desktop is extended onto other monitors (which I've already got worked out pretty well) and have it create a separate window for each one. But I cannot figure out how to create a window on a "non-primary display" portion of the desktop. Windows treats the desktops on all display screens as a single window, but calling GetWindowRect() or GetClientRect() on the Desktop window gives the dimensions of only the Primary Display, not all of them combined. I can get DCs for each individual monitor, but I can't go backwards from there to a window handle, and pulling RECTs from the display DCs gives me coordinates relative to the display, not the desktop (each display has its own origin at (0,0)).

    Basically, does anyone know how I can create a window on or move it to another display screen? Thanks in advance.
    Code:
    void function(void)
     {
      function();
     }

  2. #2
    Registered User
    Join Date
    Mar 2005
    Location
    Mountaintop, Pa
    Posts
    1,059
    Basically, does anyone know how I can create a window on or move it to another display screen? Thanks in advance.
    Why can't you use rcMonitor member of MONITORINFOEX to identify the coordinates of your non pimary display? This member gives you the virtual screen coordinates of your dual monitor setup. For example, let's assume that you have a dual monitor setup each monitor is in portrait mode 1024 x 1280 and also assume that monitor # 2 is the primary display. Now when you invoke MONITORINFOEX, the rcMonitor.left will have a negative value of -1024 and rcMonitor.top will be zero and rcmonitor.right will equal 1024 and rcmonitor.bottom will equal 1280 for monitor #1

    Monitor #2 will have rcMonitor.left set to zero and rcMonitor.top set to 0 and rcmonitor.right set to 1024 and rcMonitor.bottom set to 1280.

    Notice that the non primary display has an X origin of -1024 and the primary display has an X origin of zero.

    Bottomline, monitor the rcMonitor values and notice how they change as you change the primary display from monitor #1 to monitor #2 and vice versa. This will give you a starting point to solving your dilemma of putting a window on the primary display and putting a window on the non primary display.

  3. #3
    Work in Progress..... Jaken Veina's Avatar
    Join Date
    Mar 2005
    Location
    Missouri. Go Imos Pizza!
    Posts
    256
    Yeah, I kept searching after posting this and finally stumbled on the MSDN section about the Virtual Screen a few days later. I knew there would be some way to pull coordinates in the non-primary area, but I kept searching for "Desktop" or "Extended Desktop." It was a cinch when I knew I needed to look for "Virtual Screen." Thanks.
    Code:
    void function(void)
     {
      function();
     }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Getting Icons from the Desktop
    By Mastadex in forum Windows Programming
    Replies: 6
    Last Post: 08-29-2007, 04:33 PM
  2. Replies: 3
    Last Post: 04-24-2006, 07:45 PM
  3. "Organizing" Your Desktop for Coding
    By skim in forum Windows Programming
    Replies: 2
    Last Post: 03-13-2006, 05:52 PM
  4. Button handler
    By Nephiroth in forum Windows Programming
    Replies: 8
    Last Post: 03-12-2006, 05:23 AM
  5. Showing Desktop SW_DEFAULT
    By Yuri in forum Windows Programming
    Replies: 6
    Last Post: 11-20-2005, 12:28 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21