[This is preliminary documentation and subject to change.]
The MonitorFromRect function obtains a handle to the display monitor that has the largest area of intersection with a specified rectangle.
HMONITOR MonitorFromRect(
LPCRECT lprc, // pointer to a RECT structure
DWORD dwFlags // flags if no monitor intersects the rectangle
);
This parameter can be one of the following values.
Value | Meaning |
---|---|
MONITOR_DEFAULTTONEAREST | Return a handle to the display monitor that is nearest to the rectangle. |
MONITOR_DEFAULTTONULL | Return NULL. |
MONITOR_DEFAULTTOPRIMARY | Return a handle to the primary display monitor. |
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.
Windows NT: Requires version 5.0 or later.
Windows: Requires Windows 98.
Windows CE: Unsupported.
Header: Declared in winuser.h.
Import Library: Use user32.lib.
Multiple Display Monitors Overview, Multiple Display Monitors Functions, MonitorFromPoint, MonitorFromWindow