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. Sending a message to a dialog box to disable resizing

Sending a message to a dialog box to disable resizing

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

    Is there a message I can send to a Dialog Box that allows me to change its Border from "resizing" to "Dialog Frame"?

    L 1 Reply Last reply
    0
    • T TheDelChop

      Is there a message I can send to a Dialog Box that allows me to change its Border from "resizing" to "Dialog Frame"?

      L Offline
      L Offline
      led mike
      wrote on last edited by
      #2

      Borders are defined with styles WS_??? and/or extended styles ES_???

      led mike

      T 1 Reply Last reply
      0
      • L led mike

        Borders are defined with styles WS_??? and/or extended styles ES_???

        led mike

        T Offline
        T Offline
        TheDelChop
        wrote on last edited by
        #3

        Thanks you are correct, it is WS_THICK for a resizable border and WS_BORDER for a regular one. My question is this, I have already created a dialog box that has a resizable border, is it possible to send a message to the dialog box and change it from WS_THICK to WS_BORDER without destroying and recreating the dialog box?

        W P M L 4 Replies Last reply
        0
        • T TheDelChop

          Thanks you are correct, it is WS_THICK for a resizable border and WS_BORDER for a regular one. My question is this, I have already created a dialog box that has a resizable border, is it possible to send a message to the dialog box and change it from WS_THICK to WS_BORDER without destroying and recreating the dialog box?

          W Offline
          W Offline
          Waldermort
          wrote on last edited by
          #4

          Is it the window style you want to change or merely prevent resizing? If it's your own dialog (you coded it) you can define a WM_USER message, check for the message in your main loop at set up the MINMAXINFO accordingly. Changing the window style is a little more complicated, you would have to use the SetWindowLong() function (again after receiving a custom message). If the dialog is another process, you will have to register the window message with the OS first.

          1 Reply Last reply
          0
          • T TheDelChop

            Thanks you are correct, it is WS_THICK for a resizable border and WS_BORDER for a regular one. My question is this, I have already created a dialog box that has a resizable border, is it possible to send a message to the dialog box and change it from WS_THICK to WS_BORDER without destroying and recreating the dialog box?

            P Offline
            P Offline
            PJ Arends
            wrote on last edited by
            #5

            You could handle the WM_NCHITTEST message. First call the default handler and if the cursor is over a resizable border simply return HTBORDER to disable resizing with the mouse. To totally disable resizing you would also have to disable the Size command in the system menu.


            You may be right
            I may be crazy
            -- Billy Joel --

            Within you lies the power for good, use it!!!

            1 Reply Last reply
            0
            • T TheDelChop

              Thanks you are correct, it is WS_THICK for a resizable border and WS_BORDER for a regular one. My question is this, I have already created a dialog box that has a resizable border, is it possible to send a message to the dialog box and change it from WS_THICK to WS_BORDER without destroying and recreating the dialog box?

              M Offline
              M Offline
              Michael Dunn
              wrote on last edited by
              #6

              LONG_PTR style = GetWindowLongPtr(hwndDlg, GWL_STYLE);
              SetWindowLongPtr(hwndDlg, GWL_STYLE, (style & ~WS_THICKFRAME)|WS_BORDER);

              --Mike-- Visual C++ MVP :cool: LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ

              1 Reply Last reply
              0
              • T TheDelChop

                Thanks you are correct, it is WS_THICK for a resizable border and WS_BORDER for a regular one. My question is this, I have already created a dialog box that has a resizable border, is it possible to send a message to the dialog box and change it from WS_THICK to WS_BORDER without destroying and recreating the dialog box?

                L Offline
                L Offline
                led mike
                wrote on last edited by
                #7

                TheDelChop wrote:

                is it possible to send a message to the dialog box and change it from WS_THICK to WS_BORDER without destroying and recreating the dialog box?

                Yes but it is not a "Message". The style bits are contained in the "window long" member. If you have a MFC CDialog then use CDialog::ModifiyStyle(...) otherwise use GetWindowLong(...), SetWindowLong(...) API's.

                led mike

                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