We help IT Professionals succeed at work.

which screen is a window being displayed on?

HeinVe asked
Given a window handle, how can one tell what screen it is visible on (assuming a multi-monitor setup)?
Watch Question

Hi HeinVe,

with 'MonitorFromWindow' you can retrieve a HMONITOR handle which identifies the monitor on which the largest portion of the passed window is shown. This handle can be used with 'GetMonitorInfo' to get info about the monitor (coordinates, primary display or not, ...).

Hope that helps,