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. Preventing a Non-resizable form from maximizing when run from a shortcut

Preventing a Non-resizable form from maximizing when run from a shortcut

Scheduled Pinned Locked Moved C / C++ / MFC
3 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.
  • O Offline
    O Offline
    outlaw torn
    wrote on last edited by
    #1

    My main program dialog is supposed to be non-maximizable, it has a border style of thin and no maximize button. The problem is if I run the program using a shortcut and set the window style to maximize, it runs it maximized and it looks like cr^P. I've tried to then send messages to the dialog to simulate the user clicking the restore menu item, but this just maximizes it again. Is there any way to intercept this maximize command and/or dynamically resize the form back 2 its normal size?

    P S 2 Replies Last reply
    0
    • O outlaw torn

      My main program dialog is supposed to be non-maximizable, it has a border style of thin and no maximize button. The problem is if I run the program using a shortcut and set the window style to maximize, it runs it maximized and it looks like cr^P. I've tried to then send messages to the dialog to simulate the user clicking the restore menu item, but this just maximizes it again. Is there any way to intercept this maximize command and/or dynamically resize the form back 2 its normal size?

      P Offline
      P Offline
      Paul M Watt
      wrote on last edited by
      #2

      Handle the WM_WINDOWPOSCHANGING message. Windows sends this message when it is about to resize a window, you can override the proposed settings to the size of your dialog.

      1 Reply Last reply
      0
      • O outlaw torn

        My main program dialog is supposed to be non-maximizable, it has a border style of thin and no maximize button. The problem is if I run the program using a shortcut and set the window style to maximize, it runs it maximized and it looks like cr^P. I've tried to then send messages to the dialog to simulate the user clicking the restore menu item, but this just maximizes it again. Is there any way to intercept this maximize command and/or dynamically resize the form back 2 its normal size?

        S Offline
        S Offline
        Steen Krogsgaard
        wrote on last edited by
        #3

        If you handle the WM_GETMINMAXINFO message you can specify the allowable dimensions of your window. Cheers Steen. "To claim that computer games influence children is rediculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"

        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