static bool MonitorEnumProc(IntPtr hMonitor, IntPtr hdcMonitor, ref Rect lprcMonitor, IntPtr dwData) { MONITORINFOEX mi = new MONITORINFOEX(); mi.Size = Marshal.SizeOf(typeof(MONITORINFOEX)); NativeMethods.GetMonitorInfo(hMonitor, ref mi); Screen _screen = new Screen(); _screen.DeviceName = mi.DeviceName; _screen.WorkingArea = mi.WorkArea; AllScreens.Add(_screen); return(true); }
public static extern bool GetMonitorInfo(IntPtr hMonitor, ref MONITORINFOEX lpmi);