AdjustWindowRect

  BOOL AdjustWindowRect(lprc, fdwStyle, fMenu)    
  LPRECT lprc; /* address of client-rectangle structure */
  DWORD fdwStyle; /* window styles */
  BOOL fMenu; /* menu-present flag */

The AdjustWindowRect function computes the required size of the window rectangle based on the desired client-rectangle size. The window rectangle can then be passed to the CreateWindow function to create a window whose client area is the desired size.

Parameters

lprc

Points to a RECT structure that contains the coordinates of the client rectangle.

The RECT structure has the following form:

typedef struct tagRECT { /* rc */

LONG left;

LONG top;

LONG right;

LONG bottom;

} RECT;

fdwStyle

Specifies the window styles of the window whose client rectangle is to be converted.

fMenu

Specifies whether the window has a menu.

Return Value

The return value is TRUE if the function was successful, or FALSE if an error occurred. Use the GetLastError function to obtain extended error information.

Comments

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.

AdjustWindowRect does not take captions and borders into account when computing the size of the the client area. For window styles that include captions and borders, applications must add the caption and border sizes after calling AdjustWindowRect. This function also does not take the extra rows into account when a menu bar wraps to two or more rows.

See Also

AdjustWindowRectEx, CreateWindowEx