The MSDN Library documents the dwStyle argument of AdjustWindowRect as:
The window style of the window whose required size is to be calculated. Note that you cannot specify the WS_OVERLAPPED style.
I haven't found any explanation for this. What do they mean by "cannot" and why can't I do it?
The
WS_OVERLAPPED
style is defined as zero:AdjustWindowRect()
is checking the style flags supplied and modifies the RECT accordingly:Therefore
AdjustWindowRect()
with the dwStyle parameter set to0
does not alter the lpRect, henceWS_OVERLAPPED
cannot be used.If you wish to calculate the size for a top-level frame, you can use
WS_OVERLAPPEDWINDOW
orWS_CAPTION|WS_THICKFRAME
instead.