private static bool MonitorEnum(IntPtr hMonitor, IntPtr hdcMonitor, ref Rectangle lprcMonitor, IntPtr dwData) { var mi = new ScreenInfo(); mi.Size = (uint)Marshal.SizeOf(mi); User32Wrapper.GetMonitorInfo(hMonitor, ref mi); //think of _screenConfigs as a dictionary, where the key is the handle, so that //it keeps a record of all screens, just in case it's used again in that session var screenDetail = new ScreenDetail { Handle = hMonitor, Info = mi }; _screenConfigs.SafeAdd(hMonitor, screenDetail); return(true); }
public static extern bool GetMonitorInfo(IntPtr hmon, ref ScreenInfo mi);