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 dimensions of client area without toolbars?

How to get dimensions of client area without toolbars?

Scheduled Pinned Locked Moved C / C++ / MFC
questiontutorial
8 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.
  • M Offline
    M Offline
    Mr Freeze
    wrote on last edited by
    #1

    Hi, How can I get the position and dimension of my client area inside of my CFrameWnd without including the area of docked tool bars or status bars? Thanks :)

    C C 2 Replies Last reply
    0
    • M Mr Freeze

      Hi, How can I get the position and dimension of my client area inside of my CFrameWnd without including the area of docked tool bars or status bars? Thanks :)

      C Offline
      C Offline
      Christian Graus
      wrote on last edited by
      #2

      The docked toolbars sit inside a child window, if you could find that, you could get it's size and subtract it from GetClientRect. Christian No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
      C# will attract all comers, where VB is for IT Journalists and managers - Michael P Butler 05-12-2002
      Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002

      M 1 Reply Last reply
      0
      • C Christian Graus

        The docked toolbars sit inside a child window, if you could find that, you could get it's size and subtract it from GetClientRect. Christian No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
        C# will attract all comers, where VB is for IT Journalists and managers - Michael P Butler 05-12-2002
        Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002

        M Offline
        M Offline
        Mr Freeze
        wrote on last edited by
        #3

        Thank you Christian, I tried that, but when the toolBar is docked, it seems that the dimensions obtained with GetClientRect don't match the docking area. Also if I have several toolBars I have to check each single toolBar's status (docked or floating) and then its dimensions. Also what happens if several toolBars dock together on more than one row?

        C 1 Reply Last reply
        0
        • M Mr Freeze

          Thank you Christian, I tried that, but when the toolBar is docked, it seems that the dimensions obtained with GetClientRect don't match the docking area. Also if I have several toolBars I have to check each single toolBar's status (docked or floating) and then its dimensions. Also what happens if several toolBars dock together on more than one row?

          C Offline
          C Offline
          Christian Graus
          wrote on last edited by
          #4

          The child window that holds the toolbars is called a CMiniDockFrameWnd. You need to find those, and grab their dimensions, I think. Or create a View, maximise it, and get IT'S dimensions. Christian No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
          C# will attract all comers, where VB is for IT Journalists and managers - Michael P Butler 05-12-2002
          Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002

          M 1 Reply Last reply
          0
          • C Christian Graus

            The child window that holds the toolbars is called a CMiniDockFrameWnd. You need to find those, and grab their dimensions, I think. Or create a View, maximise it, and get IT'S dimensions. Christian No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
            C# will attract all comers, where VB is for IT Journalists and managers - Michael P Butler 05-12-2002
            Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002

            M Offline
            M Offline
            Mr Freeze
            wrote on last edited by
            #5

            Thanks again Christian, I guess I'll be able to do it with that! :-D

            1 Reply Last reply
            0
            • M Mr Freeze

              Hi, How can I get the position and dimension of my client area inside of my CFrameWnd without including the area of docked tool bars or status bars? Thanks :)

              C Offline
              C Offline
              Chris Richardson
              wrote on last edited by
              #6

              There is a CWnd member called RepositionBars. You can call it like this:

              CRect a_oRealClientArea( 0, 0, 0, 0 );
              pYourFrameWnd->RepositionBars( AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0, CWnd::reposQuery, &a_oRealClientArea, NULL, FALSE );

              Chris Richardson Programmers find all sorts of ingenious ways to screw ourselves over. - Tim Smith

              M 1 Reply Last reply
              0
              • C Chris Richardson

                There is a CWnd member called RepositionBars. You can call it like this:

                CRect a_oRealClientArea( 0, 0, 0, 0 );
                pYourFrameWnd->RepositionBars( AFX_IDW_CONTROLBAR_FIRST, AFX_IDW_CONTROLBAR_LAST, 0, CWnd::reposQuery, &a_oRealClientArea, NULL, FALSE );

                Chris Richardson Programmers find all sorts of ingenious ways to screw ourselves over. - Tim Smith

                M Offline
                M Offline
                Mr Freeze
                wrote on last edited by
                #7

                That's just perfect Chris, thanks a lot :rose: It is working very nicely now :cool:

                C 1 Reply Last reply
                0
                • M Mr Freeze

                  That's just perfect Chris, thanks a lot :rose: It is working very nicely now :cool:

                  C Offline
                  C Offline
                  Chris Richardson
                  wrote on last edited by
                  #8

                  No problem, I'm glad to hear it's working! :) Chris Richardson Programmers find all sorts of ingenious ways to screw ourselves over. - Tim Smith

                  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