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