Skip to main content
GameDev.net gamedev.net
🔒 Locked

[C++ Win32] WS_MAXIMIZE Unfunctional?

Started by Mindowindow Apr 15, 2006 at 7:10 PM 4 replies 8k views
Original Post
Mindowindow
Mindowindow
Using: Microsoft Visual C++ .NET 2003 7.1, Windows XP SP1 I'm writing a Win32 program in C++ in which the main window should initially be maximized. I have the window style set as WS_OVERLAPPEDWINDOW | WS_MAXIMIZE. This seems to work fine when I run the application from the Visual Studios Debugger (in both Debug and Release mode). However, when I open the application from its execute file the main window does not maximize. Why would opening the application from the Visual Studios Debugger recognize the WS_MAXIMIZE style and a manual execution not? (I've worked arround the problem by forcing the maximize with ShowWindow() and SM_MAXIMIZE, but this solution is rather unattractive.)
xeddiex
xeddiex
Try adding WS_VISIBLE. If that doesn't work, post some code.

- xeddiex
one..
CrazyCdn
CrazyCdn
Try the WS_VISIBLE option also but really WS_MAXIMIZE, from my understanding, just calls ShowWindow internally. Remember debug and release do have slightly different behaviors from each other.

Some more info on WS_MAXIMIZE, etc. I came across:
MSDN Link

If not post the source and we'll go from there.
"Those who would give up essential liberty to purchase a little temporary safety deserve neither liberty nor safety." --Benjamin Franklin
xeddiex
xeddiex
I tried replicating the problem and, indeed, it does not work like you described - strange. Currently, the only thing I can think of is that the properties for height and width in CreateWindow override WS_MAXIMIZE. But that still doesn't explain why it only works in the IDE. I don't think ShowWindow is the problem also because removing it (with WS_OVERLAPPEDWINDOW and WS_MAXIMIZE set) still produces the same results. I'll keep looking for a solution, while hopefully, in the meantime, someone will provide an explanation.

- xeddiex
one..
Mindowindow
Mindowindow
I've found something that might be irrelevant, but in the MSDN reference library there are two explanations for the WS_MAXIMIZE style. Under the normal reference library it is listed as:

WS_MAXIMIZE
Creates a window that is initially maximized.

...under the MFC reference library (which lists everything exactly the same as the normal reference library, except for this WS_MAXIMIZE):

WS_MAXIMIZE Creates a window of maximum size.

It could have been a typo on their part, but its odd that the problem exists exactly between the difference of these two definitions (atleast in my case the window is not maximized but of maximum size when opened outside the IDE).

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.