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. Setting minimum size for a CFrameWnd

Setting minimum size for a CFrameWnd

Scheduled Pinned Locked Moved C / C++ / MFC
csharpc++visual-studiodebuggingquestion
11 Posts 3 Posters 3 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 maxmaven

    Hi, I'd like to make my CFrameWnd subclass not resize any smaller than a certain size. Everywhere I web-search, I see that the suggested way to do this is: void CWndDerived::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI) { // set the minimum tracking width // and the minimum tracking height of the window lpMMI->ptMinTrackSize.x = 200; lpMMI->ptMinTrackSize.y = 150; } I type this into my (very simple) app, and set a breakpoint at the start of this function. It is never called. Is this method still valid? (under Visual Studio 2005 c++) Thanks, Max

    P Offline
    P Offline
    prasad_som
    wrote on last edited by
    #2

    maxmaven wrote:

    CWndDerived

    Are you sure this class window is window you are trying to resize ? A quick test in simple SDI app, shows result as expected.

    Prasad Notifier using ATL | Operator new[],delete[][^]

    M 1 Reply Last reply
    0
    • M maxmaven

      Hi, I'd like to make my CFrameWnd subclass not resize any smaller than a certain size. Everywhere I web-search, I see that the suggested way to do this is: void CWndDerived::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI) { // set the minimum tracking width // and the minimum tracking height of the window lpMMI->ptMinTrackSize.x = 200; lpMMI->ptMinTrackSize.y = 150; } I type this into my (very simple) app, and set a breakpoint at the start of this function. It is never called. Is this method still valid? (under Visual Studio 2005 c++) Thanks, Max

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

      maxmaven wrote:

      I type this...

      Did you use ClassWizard to add it? Is BEGIN_MESSAGE_MAP() correct?


      "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

      "Judge not by the eye but by the heart." - Native American Proverb

      M 1 Reply Last reply
      0
      • P prasad_som

        maxmaven wrote:

        CWndDerived

        Are you sure this class window is window you are trying to resize ? A quick test in simple SDI app, shows result as expected.

        Prasad Notifier using ATL | Operator new[],delete[][^]

        M Offline
        M Offline
        maxmaven
        wrote on last edited by
        #4

        Can you tell me exactly what you did? And are you in Visual Studio 2005, C++? I did: SDI: doesn't work SDI + DocView architecture: doesn't work SDI + Split Window: doesn't work Are you setting anything special? Or adding more than just the OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI) function? Thank you, Max

        P 1 Reply Last reply
        0
        • D David Crow

          maxmaven wrote:

          I type this...

          Did you use ClassWizard to add it? Is BEGIN_MESSAGE_MAP() correct?


          "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

          "Judge not by the eye but by the heart." - Native American Proverb

          M Offline
          M Offline
          maxmaven
          wrote on last edited by
          #5

          All I did was cut and paste the code into MainFrm.cpp, and add the function to the class declaration in MainFrm.h. Max

          D 1 Reply Last reply
          0
          • M maxmaven

            Can you tell me exactly what you did? And are you in Visual Studio 2005, C++? I did: SDI: doesn't work SDI + DocView architecture: doesn't work SDI + Split Window: doesn't work Are you setting anything special? Or adding more than just the OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI) function? Thank you, Max

            P Offline
            P Offline
            prasad_som
            wrote on last edited by
            #6

            Have you seen David's[^] reply ? Are you sure macro ON_WM_GETMINMAXINFO is there as messsage map entry ?

            Prasad Notifier using ATL | Operator new[],delete[][^]

            M 1 Reply Last reply
            0
            • M maxmaven

              All I did was cut and paste the code into MainFrm.cpp, and add the function to the class declaration in MainFrm.h. Max

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

              Then you are missing the entry in BEGIN_MESSAGE_MAP(). It's fine to add the actual code (i.e., that which is in between the curly braces) to your functions/methods, but use ClassWizard to add the prototypes.


              "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

              "Judge not by the eye but by the heart." - Native American Proverb

              M 1 Reply Last reply
              0
              • P prasad_som

                Have you seen David's[^] reply ? Are you sure macro ON_WM_GETMINMAXINFO is there as messsage map entry ?

                Prasad Notifier using ATL | Operator new[],delete[][^]

                M Offline
                M Offline
                maxmaven
                wrote on last edited by
                #8

                I do not have a message map entry. How do I add one for ON_WM_GETMINMAXINFO? Max

                D 1 Reply Last reply
                0
                • M maxmaven

                  I do not have a message map entry. How do I add one for ON_WM_GETMINMAXINFO? Max

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

                  maxmaven wrote:

                  How do I add one for ON_WM_GETMINMAXINFO?

                  As has already been mentioned, use ClassWizard.


                  "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

                  "Judge not by the eye but by the heart." - Native American Proverb

                  1 Reply Last reply
                  0
                  • D David Crow

                    Then you are missing the entry in BEGIN_MESSAGE_MAP(). It's fine to add the actual code (i.e., that which is in between the curly braces) to your functions/methods, but use ClassWizard to add the prototypes.


                    "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

                    "Judge not by the eye but by the heart." - Native American Proverb

                    M Offline
                    M Offline
                    maxmaven
                    wrote on last edited by
                    #10

                    How do I add the message map entry using a wizard? Do I use the "Add Member Function" wizard? Thanks, Max

                    D 1 Reply Last reply
                    0
                    • M maxmaven

                      How do I add the message map entry using a wizard? Do I use the "Add Member Function" wizard? Thanks, Max

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

                      Ctrl+W, unless you are using VS200x. Otherwise, see here.


                      "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

                      "Judge not by the eye but by the heart." - Native American Proverb

                      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