I don't want that the user can change the size of the main window of the application.
Printable View
I don't want that the user can change the size of the main window of the application.
Create the window without the WS_THICKFRAME style.
I create the main Window using:
If I process the WM_GETMINMAXINFO, what do I have to do so that the window can't be resized by the user?Code:hwnd = CreateWindowEx (
0, /* Extended possibilites for variation */
szClassName, /* Classname */
"Windows App", /* Title Text */
WS_OVERLAPPEDWINDOW, /* default window */
CW_USEDEFAULT, /* Windows decides the position */
CW_USEDEFAULT, /* where the window ends up on the screen */
CW_USEDEFAULT, /* The programs width */
CW_USEDEFAULT, /* and height in pixels */
HWND_DESKTOP, /* The window is a child-window to desktop */
NULL, /* No menu */
hThisInstance, /* Program Instance handler */
NULL /* No Window Creation data */
);
You used WS_OVERLAPPEDWINDOW, that is the problem.
This is what it does
WS_OVERLAPPEDWINDOW: Creates an overlapped window with the WS_OVERLAPPED, WS_CAPTION, WS_SYSMENU, WS_THICKFRAME, WS_MINIMIZEBOX, and WS_MAXIMIZEBOX styles. Same as the WS_TILEDWINDOW style.
I want a normal window except for the fact that the user can't resize it. What WS_ .. do I have to use instead of WS_OVERLAPPEDWINDOW?
//constrains window size to 640x480
case WM_GETMINMAXINFO:
{
LPPOINT lppt;
lppt = (LPPOINT)lParam; // lParam points to array of POINTS
lppt[3].x = 640;
lppt[4].x = 640;
lppt[3].y = 480;
lppt[4].y = 480;
return DefWindowProc(hwnd, msg, wParam, lParam);
}
WS_OVERLAPPEDWINDOW&~WS_THICKFRAME to create a window with a non-sizing border while retaining the other styles included with WS_OVERLAPPED. WM_GETMINMAXINFO is used to limit the dimensions of a window that can be resized by the user which is what I originally thought you were after. :)Quote:
Originally Posted by dit6a9
Many thanks for your answers. I have used
(leaving out WS_THICKFRAME) and it works fine.Code:WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_MAXIMIZEBOX