MonitorFromPoint function

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

Syntax

HMONITOR MonitorFromPoint(
  POINT pt,
  DWORD dwFlags
);

Parameters

pt

A POINT structure that specifies the point of interest in virtual-screen coordinates.

dwFlags

Determines 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
Returns a handle to the display monitor that is nearest to the point.
MONITOR_DEFAULTTONULL
Returns NULL.
MONITOR_DEFAULTTOPRIMARY
Returns a handle to the primary display monitor.

Return Value

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.

Requirements

   
Windows version Windows 2000 Professional [desktop apps only] Windows 2000 Server [desktop apps only]
Target Platform Windows
Header winuser.h (include Windows.h)
Library User32.lib
DLL User32.dll

See Also

MonitorFromRect

MonitorFromWindow

Multiple Display Monitors Functions

Multiple Display Monitors Overview