MonitorFromRect function (winuser.h)
The MonitorFromRect function retrieves a handle to the display monitor that has the largest area of intersection with a specified rectangle.
Syntax
HMONITOR MonitorFromRect(
[in] LPCRECT lprc,
[in] DWORD dwFlags
);
Parameters
[in] lprc
A pointer to a RECT structure that specifies the rectangle of interest in virtual-screen coordinates.
[in] dwFlags
Determines the function's return value if the rectangle does not intersect any display monitor.
This parameter can be one of the following values.
Return value
If the rectangle intersects one or more display monitor rectangles, the return value is an HMONITOR handle to the display monitor that has the largest area of intersection with the rectangle.
If the rectangle does not intersect a display monitor, the return value depends on the value of dwFlags.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 2000 Professional [desktop apps only] |
Minimum supported server | Windows 2000 Server [desktop apps only] |
Target Platform | Windows |
Header | winuser.h (include Windows.h) |
Library | User32.lib |
DLL | User32.dll |
API set | ext-ms-win-ntuser-sysparams-ext-l1-1-1 (introduced in Windows 10, version 10.0.14393) |