I am using the CreateWindowEx to create my main program window, however every buttons on the caption and resizing is on. I wish to disable the maximize button and disable resizing but couldn't find anything online.
How can I do that?
Printable View
I am using the CreateWindowEx to create my main program window, however every buttons on the caption and resizing is on. I wish to disable the maximize button and disable resizing but couldn't find anything online.
How can I do that?
To remove completely the buttons you should remove the WS_MINIMIZEBOX and WS_MAXIMIZEBOX styles. Use the GetWindowLong and SetWindowLong functions.
Ah I got it. I was using WS_OVERLAPPEDWINDOW instead of WS_OVERLAPPED so the buttons where all included by default. Thanks!
so is WS_POPUP the only way to remove the window border?
I use CreateWindowEx(WS_EX_TOOLWINDOW, ...), for the creation of a window with just a thin title bar, good enough to move the window and slim enough to be pretty.
I try to use:
SetWindowLong(hwnd, GWL_STYLE, WS_OVERLAPPED | WS_MINIMIZEBOX | WS_SYSMENU);
and doesn't seem to work, maybe I am doing something wrong?
Hello!
You can operate by 2 ways:
1. Disable voices in sysmenu:
2. Delete those voices from your sysmenuCode:// get the styles and properties of your window
DWORD dwStyle = GetWindowLong(hWnd, GWL_STYLE);
dwStyle &= ~(WS_MAXIMIZE|WS_SIZEBOX );
// set the window with style without titlebar and sizebox
SetWindowLong(hWnd, GWL_STYLE, dwStyle);
About displaying window without any border, I use following function:Code:// hWnd is the handle of your main window
HMENU hMenu = GetSystemMenu(hWnd, FALSE);
DeleteMenu(hMenu, SC_MAXIMIZE, MF_BYCOMMAND) ;
DeleteMenu(hMenu, SC_SIZE, MF_BYCOMMAND) ;
tell me if its works!Code:CreateWindowEx(WS_EX_TOOLWINDOW|WS_EX_TOPMOST,szWindowClass, szTitle, WS_THICKFRAME|WS_POPUP,.......);