Sign in to follow this  

[Win32 API] AdjustWindowRectEx does not adjust WS_SYSMENU windows

This topic is 4093 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Sorry for the long subject title, but I hate "plz help me!!1" topics. I think the topic is pretty straightforward, but I'll try to further explain my problem.
[source lang = "cpp" ]
Rect rcWindowRect = { 0, 0, 640, 480 };
AdjustWindowRectEx( &rcWindowRect, WS_OVERLAPPEDWINDOW, false, WS_EX_APPWINDOW );


The previous snippet of code adjusts my rcWindowRect to ( -23, -4, 644, 484 ), which are the proper value for a window client area of 640, 480. Sometimes I want my window to be of the WS_SYSMENU type, but the following code
[source lang = "cpp"]
Rect rcWindowRect = { 0, 0, 640, 480 };
AdjustWindowRectEx( &rcWindowRect, WS_SYSMENU, false, WS_EX_APPWINDOW );


does not adjust my rcWindowRect; it's still ( 0, 0, 640, 480 ). Can it be so that WM_SYSMENU alread has a client area of the created size and does not need to be adjusted?

Share this post


Link to post
Share on other sites
WS_SYSMENU is not legal on its own as a window style. It just indicates that the window has a menu on its title bar. You need to specify additional information.

In fact, to quote directly from MSDN:
"Creates a window that has a window menu on its title bar. The WS_CAPTION style must also be specified."

Share this post


Link to post
Share on other sites

This topic is 4093 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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