AdjustWindowRectExForDpi function

Calculates the required size of the window rectangle, based on the desired size of the client rectangle and the provided DPI. This window rectangle can then be passed to the CreateWindowEx function to create a window with a client area of the desired size.

Syntax


BOOL WINAPI AdjustWindowRectExForDpi(
  _Inout_ LPRECT lpRect,
  _In_    DWORD  dwStyle,
  _In_    BOOL   bMenu,
  _In_    DWORD  dwExStyle,
  _In_    UINT   dpi
);

Parameters

lpRect [in, out]

A 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 [in]

The Window Style of the window whose required size is to be calculated. Note that you cannot specify the WS_OVERLAPPED style.

bMenu [in]

Indicates whether the window has a menu.

dwExStyle [in]

The Extended Window Style of the window whose required size is to be calculated.

dpi [in]

The DPI to use for scaling.

Return value

If the function succeeds, the return value is nonzero.

If the function fails, the return value is zero. To get extended error information, call GetLastError.

Remarks

This function returns the same result as AdjustWindowRectEx but scales it according to an arbitrary DPI you provide if appropriate.

Requirements

Minimum supported client

Windows 10 [desktop apps only]

Minimum supported server

None supported

Header

Winuser.h (include Windows.h)

Library

User32.lib

DLL

User32.dll

 

 

Show: