Sending a message to a dialog box to disable resizing
-
Is there a message I can send to a Dialog Box that allows me to change its Border from "resizing" to "Dialog Frame"?
-
Is there a message I can send to a Dialog Box that allows me to change its Border from "resizing" to "Dialog Frame"?
-
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?
-
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?
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.
-
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?
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!!!
-
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?
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
-
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?
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