MonitorFromPoint

[This is preliminary documentation and subject to change.]

The MonitorFromPoint function obtains a handle to the display monitor that contains a specified point.

HMONITOR MonitorFromPoint(
  POINT pt,      // a specified point 
  DWORD dwFlags  // flags if no monitor contains specified point 
);
 

Parameters

pt
A POINT structure that specifies the point of interest.
dwFlags
A set of flags that determine the function's return value if the point is not contained within any display monitor.

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 point.
MONITOR_DEFAULTTONULL Return NULL.
MONITOR_DEFAULTTOPRIMARY Return a handle to the primary display monitor.

Return Values

If the point is contained by a display monitor, the return value is an HMONITOR handle to that display monitor.

If the point is not contained by a display monitor, the return value depends on the value of dwFlags.

QuickInfo

  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.

See Also

Multiple Display Monitors Overview, Multiple Display Monitors Functions, MonitorFromRect, MonitorFromWindow