This function calculates the required size of the rectangle of a window with extended style based on the desired client-rectangle size. The window rectangle can then be passed to the CreateWindowEx function to create a window whose client area is the desired size.
At a Glance
Header file: | Winuser.h |
Windows CE versions: | 1.0 and later |
Syntax
BOOL AdjustWindowRectEx( LPRECT lpRect, DWORD dwStyle,
BOOL bMenu, DWORD dwExStyle );
Parameters
lpRect
Long pointer to a RECT structure that contains the coordinates of the top-left and bottom-right corners of the desired client area. When the function returns, the structure contains the coordinates of the top-left and bottom-right corners of the window to accommodate the desired client area.
dwStyle
Specifies the window styles of the window whose required size is to be calculated.
bMenu
Boolean that specifies whether the window has a menu.
dwExStyle
Specifies the extended style of the window whose required size is to be calculated.
Return Values
Nonzero indicates success. Zero indicates failure. To get extended error information, call GetLastError.
Remarks
The bMenu parameter must be FALSE; menu bars are not supported.
A client rectangle is the smallest rectangle that completely encloses a client area. A window rectangle is the smallest rectangle that completely encloses the window, which includes the client area and the nonclient area.
When an invalid window style is specified in the dwStyle parameter, the WS_POPUP style is assumed and used for the window calculation. For a description of supported window styles, see CreateWindowEx.
The AdjustWindowRectEx function does not add extra space when a menu bar wraps to two or more rows.
See Also