Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Detect working area of primary monitor

Detect working area of primary monitor

Scheduled Pinned Locked Moved C / C++ / MFC
questionworkspace
3 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    vg8open
    wrote on last edited by
    #1

    I have a program that display a popup dialog above the notification area of the task bar. I am using the following function to get the work area of the primary monitor. CRect rcDesktop; ::SystemParametersInfo(SPI_GETWORKAREA,0,&rcDesktop,0); CRect rc; GetWindowRect(rc); ScreenToClient(rc); unsigned int m_nStartPosX = rcDesktop.right - rc.Width() - 1; unsigned int m_nStartPosY = rcDesktop.bottom - rc.Height(); SetWindowPos( &wndTop, m_nStartPosX, m_nStartPosY, rc.Width(), rc.Height(), SWP_NOOWNERZORDER | SWP_NOACTIVATE); I tested my program on my single/dual monitor setups and it's working correctly, but one of my users reported that on his three monitor setup, the popup dialog is displaying on the wrong monitor. It seems like SystemParametersInfo() can't get the correct working area on his system. Does anyone know any other way to get the working area of the primary monitor?

    P L 2 Replies Last reply
    0
    • V vg8open

      I have a program that display a popup dialog above the notification area of the task bar. I am using the following function to get the work area of the primary monitor. CRect rcDesktop; ::SystemParametersInfo(SPI_GETWORKAREA,0,&rcDesktop,0); CRect rc; GetWindowRect(rc); ScreenToClient(rc); unsigned int m_nStartPosX = rcDesktop.right - rc.Width() - 1; unsigned int m_nStartPosY = rcDesktop.bottom - rc.Height(); SetWindowPos( &wndTop, m_nStartPosX, m_nStartPosY, rc.Width(), rc.Height(), SWP_NOOWNERZORDER | SWP_NOACTIVATE); I tested my program on my single/dual monitor setups and it's working correctly, but one of my users reported that on his three monitor setup, the popup dialog is displaying on the wrong monitor. It seems like SystemParametersInfo() can't get the correct working area on his system. Does anyone know any other way to get the working area of the primary monitor?

      P Offline
      P Offline
      peterchen
      wrote on last edited by
      #2

      Looks good to me. Rather than looing for "another method" I'd verify user assumptions about where the dialog is supposed to appear are right. Also, trace or log output (return value, GetLastError, coordinates acquired).

      ORDER BY what user wants

      1 Reply Last reply
      0
      • V vg8open

        I have a program that display a popup dialog above the notification area of the task bar. I am using the following function to get the work area of the primary monitor. CRect rcDesktop; ::SystemParametersInfo(SPI_GETWORKAREA,0,&rcDesktop,0); CRect rc; GetWindowRect(rc); ScreenToClient(rc); unsigned int m_nStartPosX = rcDesktop.right - rc.Width() - 1; unsigned int m_nStartPosY = rcDesktop.bottom - rc.Height(); SetWindowPos( &wndTop, m_nStartPosX, m_nStartPosY, rc.Width(), rc.Height(), SWP_NOOWNERZORDER | SWP_NOACTIVATE); I tested my program on my single/dual monitor setups and it's working correctly, but one of my users reported that on his three monitor setup, the popup dialog is displaying on the wrong monitor. It seems like SystemParametersInfo() can't get the correct working area on his system. Does anyone know any other way to get the working area of the primary monitor?

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Hi, Make sure you are compiling with COMPILE_MULTIMON_STUBS defined and add #include <multimon.h> Best Wishes, -David Delaune

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups