[Win32 API] AdjustWindowRectEx does not adjust WS_SYSMENU windows

Started by
1 comment, last by Wixner 17 years, 6 months ago
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?
Advertisement
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."
Oh my god - how silly of me to miss that :D
Thank you :)

This topic is closed to new replies.

Advertisement