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. Height of status bar?

Height of status bar?

Scheduled Pinned Locked Moved C / C++ / MFC
question
7 Posts 6 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.
  • O Offline
    O Offline
    One Stone
    wrote on last edited by
    #1

    Hello! How can I determine the height in pixels of status bars? The GetSystemMetrics function seems to give many such values, but doesn't support status bars?? Best regards

    T R D B 4 Replies Last reply
    0
    • O One Stone

      Hello! How can I determine the height in pixels of status bars? The GetSystemMetrics function seems to give many such values, but doesn't support status bars?? Best regards

      T Offline
      T Offline
      toxcct
      wrote on last edited by
      #2

      what about SetWindowPos() ?


      TOXCCT >>> GEII power
      [toxcct][VisualCalc]

      1 Reply Last reply
      0
      • O One Stone

        Hello! How can I determine the height in pixels of status bars? The GetSystemMetrics function seems to give many such values, but doesn't support status bars?? Best regards

        R Offline
        R Offline
        Ravi Bhavnani
        wrote on last edited by
        #3

        Perhaps you could try getting the dimensions of the CStatusBarCtrl that is contained within a CStatusBar? /ravi My new year's resolution: 2048 x 1536 Home | Articles | Freeware | Music ravib@ravib.com

        1 Reply Last reply
        0
        • O One Stone

          Hello! How can I determine the height in pixels of status bars? The GetSystemMetrics function seems to give many such values, but doesn't support status bars?? Best regards

          D Offline
          D Offline
          David Crow
          wrote on last edited by
          #4

          The size of a status bar is application-dependent. You'll need to take the height of the main window and then subtract other heights from it like caption, menu, non-client area, and border. There may be other values, too.


          "Ideas are a dime a dozen. People who put them into action are priceless." - Unknown

          1 Reply Last reply
          0
          • O One Stone

            Hello! How can I determine the height in pixels of status bars? The GetSystemMetrics function seems to give many such values, but doesn't support status bars?? Best regards

            B Offline
            B Offline
            Blake Miller
            wrote on last edited by
            #5

            Get the window handle to the status bar's window. Then can call GetWindowRect. Take the height of the rectangle as the height of the status bar.

            J 1 Reply Last reply
            0
            • B Blake Miller

              Get the window handle to the status bar's window. Then can call GetWindowRect. Take the height of the rectangle as the height of the status bar.

              J Offline
              J Offline
              joerg smn
              wrote on last edited by
              #6

              How can I get the handle? I tried the following from my View-class: CMyView::OnInitialUpdate() { ... CRect rcStatusBar; CFrameWnd* pFrame = (CFrameWnd*) GetParent(); CStatusBar* pStatusBar = (CStatusBar*) pFrame->GetControlBar(AFX_IDW_STATUS_BAR); CStatusBarCtrl& statusBarCtrl = pStatusBar->GetStatusBarCtrl(); statusBarCtrl.GetWindowRect(rcStatusBar); ... } But this leaves me with a CRect with the size of 0 height and 0 width...

              B 1 Reply Last reply
              0
              • J joerg smn

                How can I get the handle? I tried the following from my View-class: CMyView::OnInitialUpdate() { ... CRect rcStatusBar; CFrameWnd* pFrame = (CFrameWnd*) GetParent(); CStatusBar* pStatusBar = (CStatusBar*) pFrame->GetControlBar(AFX_IDW_STATUS_BAR); CStatusBarCtrl& statusBarCtrl = pStatusBar->GetStatusBarCtrl(); statusBarCtrl.GetWindowRect(rcStatusBar); ... } But this leaves me with a CRect with the size of 0 height and 0 width...

                B Offline
                B Offline
                Blake Miller
                wrote on last edited by
                #7

                These are all MFC Window objects. It is possible that during the OnInitialUpdate that the true 'window' have not yet been created? You can check with: ::IsWindow(pFrame->m_hWnd) and if that is not true, your windows don't exist yet, so all widnow rectangles will return empty rectangles. You might have to investigate something like RecalcLayout and call it from some other location once the windows exist.

                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