User32MonitorFromRect(NativeRectangle, MonitorFromFlags) Method

Retrieves a handle to the display monitor that has the largest area of intersection with a specified rectangle.

Definition

Namespace: DevCase.Win32.NativeMethods
Assembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[DllImportAttribute("User32.dll", ExactSpelling = true)]
public static IntPtr MonitorFromRect(
	in NativeRectangle refRect,
	MonitorFromFlags flags
)

Parameters

refRect  NativeRectangle
A NativeRectangle structure that specifies the rectangle of interest in virtual-screen coordinates.
flags  MonitorFromFlags
Determines the function's return value if the rectangle does not intersect any display monitor

Return Value

IntPtr
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 flags.

Remarks

See Also