static MonitorArea GetMonitorAreaEx(IntPtr hMonitor) { bool success = false; var mi = new MONITORINFOEX() { cbSize = Marshal.SizeOf(typeof(MONITORINFOEX)) }; if (hMonitor != IntPtr.Zero) { success = GetMonitorInfo(hMonitor, ref mi); } return(success ? new MonitorArea(mi.rcMonitor, mi.rcWork, mi.szDevice) : null); }
static extern bool GetMonitorInfo([In] IntPtr hMonitor, [In, Out] ref MONITORINFOEX lpmi);