private static List<MonitorInfoEx> GetDisplays() { var result = new List<MonitorInfoEx>(); Methods.EnumDisplayMonitors( IntPtr.Zero, IntPtr.Zero, (IntPtr hMonitor, IntPtr hdcMonitor, ref Rectangle lprcMonitor, IntPtr dwData) => { var mi = new MonitorInfoEx().Initialize(); var success = Methods.GetMonitorInfo(hMonitor, ref mi); if (success) { result.Add(mi); } return true; }, IntPtr.Zero); return result; }
public static extern bool GetMonitorInfo(IntPtr hMonitor, ref MonitorInfoEx lpmi);