Example #1
0
        private Monitor(IntPtr handle)
        {
            Handle = handle;
            var mi = new MONITORINFOEX();

            mi.cbSize = Marshal.SizeOf(mi);
            if (!GetMonitorInfo(handle, ref mi))
            {
                throw new Win32Exception(Marshal.GetLastWin32Error());
            }

            DeviceName  = mi.szDevice.ToString();
            Bounds      = mi.rcMonitor;
            WorkingArea = mi.rcWork;
            IsPrimary   = (mi.dwFlags & MONITORINFOF_PRIMARY) == MONITORINFOF_PRIMARY;
        }
Example #2
0
 private static extern bool GetMonitorInfo(IntPtr hmonitor, ref MONITORINFOEX info);