How do I disable the maximize button
Hello everyone thanks for taking some time to read my thread. I have been making my puzzle game for some time now and decided that I want it in window mode not fullscreen. So once I changed to window mode I relized I dont want the player to be able to resize the window or maximize it. So im trying to get the same window effect as minesweeper on windows. I found CS_NOCLOSE which disables the close button but cant find one which disables the maximize button. Any ideas. Thanks.
What is your "dwstyle" value for the CreateWindow(...) function. Its in that section that you decide whether or not to use those type of functions, like the maximize button.
There is no CS_* option to disable it. For most people, when beginning to program, they use the WS_OVERLAPPEDWINDOW style in CreateWindow. If you check the docs, this is a bitwise combination of different WS_* styles. One of them enables the maximize button. What you really want is to look up the WS_ styles for CreateWindow and just specify the ones you want, using the bitwise OR operator |
At the moment im using WS_OVERLAPPEDWINDOW | WS_VISIBLE
I managed to disable the close button by putting CS_NOCLOSE in style from my WNDCLASSEX structure so im woundering if theres something like that for the maximize.
I managed to disable the close button by putting CS_NOCLOSE in style from my WNDCLASSEX structure so im woundering if theres something like that for the maximize.
Ok i have finally found what i was looking for. I know have a non resizeable window with just the close button. That should do the job nicely.
WS_BORDER | WS_CAPTION | WS_SYSMENU | WS_VISIBLE
Thanks for the help guys.
WS_BORDER | WS_CAPTION | WS_SYSMENU | WS_VISIBLE
Thanks for the help guys.
Been a little while since I touched Win32, but replacing "WS_OVERLAPPED" with "WS_MINIMIZE" should be fine.
The reason the max button is there is because your using WS_OVERLAPPEDWINDOW. It's a combination of other WS_* 's. Lookup the window styles available and manually specifiy each one.
Quote:Original post by cNoob
At the moment im using WS_OVERLAPPEDWINDOW | WS_VISIBLE
I managed to disable the close button by putting CS_NOCLOSE in style from my WNDCLASSEX structure so im woundering if theres something like that for the maximize.
As the AP said, no, there isn't. Again as the AP said, if you look at the window styles docs WS_OVERLAPPEDWINDOW is the same thing as WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX. And finally as the AP said, you can simply omit |ing the flags you don't want, meaning removing the "| WS_MINIMIZEBOX".
Just replace WS_OVERLAPPEDWINDOW with WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX.
EDIT: Way too late :P
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement