MonitorFromWindow function
The MonitorFromWindow function retrieves a handle to the display monitor that has the largest area of intersection with the bounding rectangle of a specified window.
Syntax
HMONITOR MonitorFromWindow( _In_ HWND hwnd, _In_ DWORD dwFlags );
Parameters
- hwnd [in]
-
A handle to the window of interest.
- dwFlags [in]
-
Determines the function's return value if the window does not intersect any display monitor.
This parameter can be one of the following values.
Return value
If the window 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 window.
If the window does not intersect a display monitor, the return value depends on the value of dwFlags.
Remarks
If the window is currently minimized, MonitorFromWindow uses the rectangle of the window before it was minimized.
Requirements
|
Minimum supported client |
Windows 2000 Professional [desktop apps only] |
|---|---|
|
Minimum supported server |
Windows 2000 Server [desktop apps only] |
|
Header |
|
|
Library |
|
|
DLL |
|
See also
- Multiple Display Monitors Overview
- Multiple Display Monitors Functions
- MonitorFromPoint
- MonitorFromRect