Sign in to follow this  
cNoob

How do I disable the maximize button

Recommended Posts

cNoob    295
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.

Share this post


Link to post
Share on other sites
Bliz23    188
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.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
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 |

Share this post


Link to post
Share on other sites
cNoob    295
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.

Share this post


Link to post
Share on other sites
cNoob    295
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.

Share this post


Link to post
Share on other sites
Smit    310
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Bliz23    188
WS_OVERLAPPEDWINDOW == (WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_THICKFRAME|WS_MINIMIZEBOX|WS_MAXIMIZEBOX) So, just replace WS_OVERLAPPEDWINDOW with (WS_OVERLAPPED|WS_CAPTION|WS_SYSMENU|WS_THICKFRAME|WS_MINIMIZEBOX). And there is no equivalent with CS_NOCLOSE for disabling maximizing. Why windows disables the close button and enables the maximize button in two different spots is confusing to me, but thats how its done.

Share this post


Link to post
Share on other sites
cNoob    295
Ok guys thanks alot for the help i have now changed my code to WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_MINIMIZEBOX | WS_VISIBLE didnt need the thick frame it allows the user to resize the window but it works just how i want it(minesweeper). Thanks again guys you have all helped alot. :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this