public bool Add(IntPtr hMonitor) { uint monitorCount = 0; NativeMethods.GetNumberOfPhysicalMonitorsFromHMONITOR(hMonitor, ref monitorCount); if (monitorCount <= 0) { return(false); } var monitorArray = new NativeStructures.PHYSICAL_MONITOR[monitorCount]; NativeMethods.GetPhysicalMonitorsFromHMONITOR(hMonitor, monitorCount, monitorArray); foreach (var physicalMonitor in monitorArray) { Monitor newMonitor = new Monitor(physicalMonitor); this.Add(newMonitor); } return(true); }
public Monitor(NativeStructures.PHYSICAL_MONITOR physicalMonitor) { HPhysicalMonitor = physicalMonitor.hPhysicalMonitor; Name = physicalMonitor.szPhysicalMonitorDescription; CheckCapabilities(); }