public static unsafe bool GetMonitorInfo( IntPtr hMonitor, out MONITORINFOEX lpmi) { lpmi = MONITORINFOEX.Create(); fixed(MONITORINFOEX *lpmiLocal = &lpmi) { return(GetMonitorInfo(hMonitor, lpmiLocal)); } }
internal static Screen Create(IntPtr hMonitor) { var monitorInfo = MONITORINFOEX.Create(); var success = MultiMonitorNativeMethods.GetMonitorInfo(hMonitor, ref monitorInfo); if (!success) { return(null); } var dpi = Dpi.Create(hMonitor); return(new Screen(hMonitor) { DeviceName = monitorInfo.szDevice, IsPrimary = monitorInfo.dwFlags == MultiMonitorNativeMethods.MONITORINFOF_PRIMARY, Dpi = dpi, Bounds = CreateRect(monitorInfo.rcMonitor, dpi), WorkingArea = CreateRect(monitorInfo.rcWork, dpi) }); }