Group: Multiple Display Monitors - Library: user32
Retrieves a handle to the display monitor that has the largest area of intersection with the bounding rectangle of a specified window.
How to change display settings: screen resolution, screen refresh rate
How to detect if additional monitor is connected and active
How to adjust monitor brightness (Vista, monitor with DDC support)
HMONITOR MonitorFromWindow(
HWND hwnd, // handle to a window
DWORD dwFlags // determine return value
);
DECLARE INTEGER MonitorFromWindow IN user32;
INTEGER hWindow,;
INTEGER dwFlags
hwnd [in] Handle to the window of interest.
dwFlags [in] Determines the function"s return value if the window does not intersect any display monitor.
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.
It might be possible that handles to multiple monitors are not random and start with 0x10001 value.
See also GetMonitorInfo, EnumDisplayDevices functions.