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
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to Get desktop coordinates.

How to Get desktop coordinates.

Scheduled Pinned Locked Moved C / C++ / MFC
tutorial
6 Posts 4 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.
  • B Offline
    B Offline
    birajendu
    wrote on last edited by
    #1

    HI, I am creating Window using window class. I added just a menu bar. I need couple of coordinates to give flexibilities to my window. 1. How I will get the height and with of a desktop, cause i may use this application in multiple resolution desktops. 2. Inside the window I have a menu bar only. I need to know the coordinates of left-bottom corner of that menu bar so that I can create other control inside my window. Thanks in advance...

    birajendu SonicWALL Bangalore India

    C T S 3 Replies Last reply
    0
    • B birajendu

      HI, I am creating Window using window class. I added just a menu bar. I need couple of coordinates to give flexibilities to my window. 1. How I will get the height and with of a desktop, cause i may use this application in multiple resolution desktops. 2. Inside the window I have a menu bar only. I need to know the coordinates of left-bottom corner of that menu bar so that I can create other control inside my window. Thanks in advance...

      birajendu SonicWALL Bangalore India

      C Offline
      C Offline
      chandu004
      wrote on last edited by
      #2

      hai 1: try to explore GetSystemmetrics or getdesktopwindow() function. 2: AFAIK, i guess, for what ever the resolution maybe, the menu bar size(height) will be same in pixels, wrt the window. so, you can hardcode it. or you can use GetWindowRect to get the bounds of your menu bar.

      -------------------------------------------- Suggestion to the members: Please prefix your main thread subject with [SOLVED] if it is solved. thanks. chandu.

      modified on Thursday, June 18, 2009 11:58 PM

      B 1 Reply Last reply
      0
      • B birajendu

        HI, I am creating Window using window class. I added just a menu bar. I need couple of coordinates to give flexibilities to my window. 1. How I will get the height and with of a desktop, cause i may use this application in multiple resolution desktops. 2. Inside the window I have a menu bar only. I need to know the coordinates of left-bottom corner of that menu bar so that I can create other control inside my window. Thanks in advance...

        birajendu SonicWALL Bangalore India

        T Offline
        T Offline
        Taran9
        wrote on last edited by
        #3

        For determining the resolution(xMax X yMax), you can use

        xMax = GetSystemMetrics(SM_CXSCREEN)
        yMax = GetSystemMetrics(SM_CYSCREEN)

        and for knowing the coordinates, use GetClientRect and change it to screen coordinates, if required, by using ClientToScreen API.

        B 1 Reply Last reply
        0
        • B birajendu

          HI, I am creating Window using window class. I added just a menu bar. I need couple of coordinates to give flexibilities to my window. 1. How I will get the height and with of a desktop, cause i may use this application in multiple resolution desktops. 2. Inside the window I have a menu bar only. I need to know the coordinates of left-bottom corner of that menu bar so that I can create other control inside my window. Thanks in advance...

          birajendu SonicWALL Bangalore India

          S Offline
          S Offline
          Sarath C
          wrote on last edited by
          #4

          See some handy information - Multi Monotor Program Basics[^]

          -Sarath. "Great hopes make everything great possible" - Benjamin Franklin

          My blog - Sharing My Thoughts

          1 Reply Last reply
          0
          • T Taran9

            For determining the resolution(xMax X yMax), you can use

            xMax = GetSystemMetrics(SM_CXSCREEN)
            yMax = GetSystemMetrics(SM_CYSCREEN)

            and for knowing the coordinates, use GetClientRect and change it to screen coordinates, if required, by using ClientToScreen API.

            B Offline
            B Offline
            birajendu
            wrote on last edited by
            #5

            This gave me whole screen, I used GetSystemMetrics(SM_CXMAXIMIZED) GetSystemMetrics(SM_CYMAXIMIZED) For my purpose...Thanks a lot.

            birajendu CyberG India Delhi India

            1 Reply Last reply
            0
            • C chandu004

              hai 1: try to explore GetSystemmetrics or getdesktopwindow() function. 2: AFAIK, i guess, for what ever the resolution maybe, the menu bar size(height) will be same in pixels, wrt the window. so, you can hardcode it. or you can use GetWindowRect to get the bounds of your menu bar.

              -------------------------------------------- Suggestion to the members: Please prefix your main thread subject with [SOLVED] if it is solved. thanks. chandu.

              modified on Thursday, June 18, 2009 11:58 PM

              B Offline
              B Offline
              birajendu
              wrote on last edited by
              #6

              thanks...

              birajendu CyberG India Delhi India

              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