|
-
September 8th, 2009, 07:37 AM
#1
How to create a Window and disable maximize/resize?
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?
-
September 8th, 2009, 06:59 PM
#2
Re: How to create a Window and disable maximize/resize?
To remove completely the buttons you should remove the WS_MINIMIZEBOX and WS_MAXIMIZEBOX styles. Use the GetWindowLong and SetWindowLong functions.
-
September 9th, 2009, 12:48 AM
#3
Re: How to create a Window and disable maximize/resize?
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?
-
September 9th, 2009, 02:51 AM
#4
Re: How to create a Window and disable maximize/resize?
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.
-
September 9th, 2009, 05:51 PM
#5
Re: How to create a Window and disable maximize/resize?
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?
-
September 10th, 2009, 02:22 AM
#6
Re: How to create a Window and disable maximize/resize?
Hello!
You can operate by 2 ways:
1. Disable voices in sysmenu:
Code:
// 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);
2. Delete those voices from your sysmenu
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) ;
About displaying window without any border, I use following function:
Code:
CreateWindowEx(WS_EX_TOOLWINDOW|WS_EX_TOPMOST,szWindowClass, szTitle, WS_THICKFRAME|WS_POPUP,.......);
tell me if its works!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|