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. Resizing windows

Resizing windows

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
7 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.
  • D Offline
    D Offline
    dart13
    wrote on last edited by
    #1

    How to make a non-resizeable window?

    B C D 3 Replies Last reply
    0
    • D dart13

      How to make a non-resizeable window?

      B Offline
      B Offline
      BlackDice
      wrote on last edited by
      #2

      if it's a dialog you should be able to set the appropriate border style property. Or if not, try handling the WM_SIZE (or WM_RESIZE) message so that it calls a this->Move(0,0,100,100) or whatever your original size is, or try handling it so that it does nothing. If it's broken, I probably did it bdiamond

      D 1 Reply Last reply
      0
      • D dart13

        How to make a non-resizeable window?

        C Offline
        C Offline
        Curi0us_George
        wrote on last edited by
        #3

        Depends on what kind of window library you're using. (MFC? WTL? Raw Win32?) If you're using the raw Win32 API, you simply set the appropriate window style when calling CreateWindow() or CreateWindowEx(). It's the WS_THICKFRAME style that adds the resizable border, so don't use it. Also don't use WS_TILEDWINDOW or WS_OVERLAPPEDWINDOW, as those styles include use WS_THICKFRAME. Try (WS_OVERLAPPED | WS_MINIMIZEBOX | WS_SYSMENU) as your window style. It will probably be exactly what you want.

        D 1 Reply Last reply
        0
        • B BlackDice

          if it's a dialog you should be able to set the appropriate border style property. Or if not, try handling the WM_SIZE (or WM_RESIZE) message so that it calls a this->Move(0,0,100,100) or whatever your original size is, or try handling it so that it does nothing. If it's broken, I probably did it bdiamond

          D Offline
          D Offline
          dart13
          wrote on last edited by
          #4

          It is SDI application with CFormView. I want to prevent resizing the main window. I tried handling WM_SIZE in CMainFrame and CFormView to do nothing, but it didn't work out. If I put MoveWindow() then the window starts resizeing but when you release a mouse button it goes back. But this solution is not what I wanted. Is there a parameter that you can pass to Create() so it makes window non-resizeable, or some similar solution?

          1 Reply Last reply
          0
          • C Curi0us_George

            Depends on what kind of window library you're using. (MFC? WTL? Raw Win32?) If you're using the raw Win32 API, you simply set the appropriate window style when calling CreateWindow() or CreateWindowEx(). It's the WS_THICKFRAME style that adds the resizable border, so don't use it. Also don't use WS_TILEDWINDOW or WS_OVERLAPPEDWINDOW, as those styles include use WS_THICKFRAME. Try (WS_OVERLAPPED | WS_MINIMIZEBOX | WS_SYSMENU) as your window style. It will probably be exactly what you want.

            D Offline
            D Offline
            dart13
            wrote on last edited by
            #5

            It is SDI application with CFormView. I want to prevent resizing the main window. I put parameters you told me for CMainFrame and it worked. Thanx.

            C 1 Reply Last reply
            0
            • D dart13

              It is SDI application with CFormView. I want to prevent resizing the main window. I put parameters you told me for CMainFrame and it worked. Thanx.

              C Offline
              C Offline
              Curi0us_George
              wrote on last edited by
              #6

              Glad it worked for you. :)

              1 Reply Last reply
              0
              • D dart13

                How to make a non-resizeable window?

                D Offline
                D Offline
                Dimitris Vasiliadis
                wrote on last edited by
                #7

                Try handling the WM_SIZING message.


                ...Plug & Pray... X|

                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