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. - Screen Resolution -

- Screen Resolution -

Scheduled Pinned Locked Moved C / C++ / MFC
question
5 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.
  • J Offline
    J Offline
    JensB
    wrote on last edited by
    #1

    Hi How can i detect the current screen resolution (1024/768 or others) and how can i know how big (f.e. in pixels) the screen of an application is? Greetings Jens

    A 1 Reply Last reply
    0
    • J JensB

      Hi How can i detect the current screen resolution (1024/768 or others) and how can i know how big (f.e. in pixels) the screen of an application is? Greetings Jens

      A Offline
      A Offline
      armentage
      wrote on last edited by
      #2

      hwnd desktop = GetDesktopWindow(VOID); RECT myrect; GetWindowRect(desktop, &myrect); This will load 'myrect' with the size of the desktop window. I'm not sure how it will behave on a multi-screen setup. You might get the size of the first display's desktop only, or maybe the size of the ENTIRE desktop. There are some functions to enumerate the actual displays, but I don't remember any of the details.

      L 1 Reply Last reply
      0
      • A armentage

        hwnd desktop = GetDesktopWindow(VOID); RECT myrect; GetWindowRect(desktop, &myrect); This will load 'myrect' with the size of the desktop window. I'm not sure how it will behave on a multi-screen setup. You might get the size of the first display's desktop only, or maybe the size of the ENTIRE desktop. There are some functions to enumerate the actual displays, but I don't remember any of the details.

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

        int x = GetSystemMetrics(SM_CXSCREEN) int y = GetSystemMetrics(SM_CYSCREEN)

        A 1 Reply Last reply
        0
        • L Lost User

          int x = GetSystemMetrics(SM_CXSCREEN) int y = GetSystemMetrics(SM_CYSCREEN)

          A Offline
          A Offline
          armentage
          wrote on last edited by
          #4

          Greg S. wrote: int x = GetSystemMetrics(SM_CXSCREEN) int y = GetSystemMetrics(SM_CYSCREEN) This might only give you the resolution of ONE screen, not your whole desktop.

          L 1 Reply Last reply
          0
          • A armentage

            Greg S. wrote: int x = GetSystemMetrics(SM_CXSCREEN) int y = GetSystemMetrics(SM_CYSCREEN) This might only give you the resolution of ONE screen, not your whole desktop.

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

            SM_CXVIRTUALSCREEN, SM_CYVIRTUALSCREEN :-D

            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