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. Size of a window

Size of a window

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

    HWND hWnd; After that declaration, please, how can I find the total outside size of the current window including the window's frames and menu and any scroll bars etc, not only the window's available area for writing text and images in?

    OriginalGriffO V 2 Replies Last reply
    0
    • A Anthony Appleyard

      HWND hWnd; After that declaration, please, how can I find the total outside size of the current window including the window's frames and menu and any scroll bars etc, not only the window's available area for writing text and images in?

      OriginalGriffO Offline
      OriginalGriffO Offline
      OriginalGriff
      wrote on last edited by
      #2

      Once you have the window handle, you just call GetWindowRect[^]

      Bad command or file name. Bad, bad command! Sit! Stay! Staaaay... AntiTwitter: @DalekDave is now a follower!

      "I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
      "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt

      1 Reply Last reply
      0
      • A Anthony Appleyard

        HWND hWnd; After that declaration, please, how can I find the total outside size of the current window including the window's frames and menu and any scroll bars etc, not only the window's available area for writing text and images in?

        V Offline
        V Offline
        Victor Nijegorodov
        wrote on last edited by
        #3

        There are some window functions you can use: [Window Functions (Windows)](https://msdn.microsoft.com/en-us/library/windows/desktop/ff468919(v=vs.85).aspx)

        A 1 Reply Last reply
        0
        • V Victor Nijegorodov

          There are some window functions you can use: [Window Functions (Windows)](https://msdn.microsoft.com/en-us/library/windows/desktop/ff468919(v=vs.85).aspx)

          A Offline
          A Offline
          Anthony Appleyard
          wrote on last edited by
          #4

          Thanks. SetWindowPos() sets up a window, and needs the desired total window size including borders and scroll bars etc. Can I find easily the values of the needed total window size (say xj and yj) needed to set up a window whose image-and-text area (= client area) is xi * yi)?

          L 1 Reply Last reply
          0
          • A Anthony Appleyard

            Thanks. SetWindowPos() sets up a window, and needs the desired total window size including borders and scroll bars etc. Can I find easily the values of the needed total window size (say xj and yj) needed to set up a window whose image-and-text area (= client area) is xi * yi)?

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

            Use GetWindowRect and GetClientRect to find those two values. The difference is the size of the frame portion. You can then calculate your required client size, add that to the frame sizes to get your new window size.

            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