public DdcMonitorItem( string deviceInstanceId, string description, byte displayIndex, byte monitorIndex, SafePhysicalMonitorHandle handle) { _handle = handle ?? throw new ArgumentNullException(nameof(handle)); if (string.IsNullOrWhiteSpace(deviceInstanceId)) { throw new ArgumentNullException(nameof(deviceInstanceId)); } if (string.IsNullOrWhiteSpace(description)) { throw new ArgumentNullException(nameof(description)); } DeviceInstanceId = deviceInstanceId; Description = description; DisplayIndex = displayIndex; MonitorIndex = monitorIndex; }
/// <summary> /// Sets raw brightness not represented in percentage. /// </summary> /// <param name="physicalMonitorHandle">Physical monitor handle</param> /// <param name="brightness">Raw brightness (not always 0 to 100)</param> /// <param name="useLowLevel">Whether to use low level function</param> /// <returns>True if successfully sets</returns> public static bool SetBrightness(SafePhysicalMonitorHandle physicalMonitorHandle, uint brightness) { if (physicalMonitorHandle is null) { throw new ArgumentNullException(nameof(physicalMonitorHandle)); } if (physicalMonitorHandle.IsClosed) { Debug.WriteLine("Failed to set brightness. The physical monitor handle has been closed."); return(false); } if (!SetMonitorBrightness( physicalMonitorHandle, brightness)) { Debug.WriteLine($"Failed to set brightness. "); return(false); } return(true); }
private static extern bool SetMonitorBrightness( SafePhysicalMonitorHandle hMonitor, uint dwNewBrightness);
private static extern bool GetMonitorBrightness( SafePhysicalMonitorHandle hMonitor, out uint pdwMinimumBrightness, out uint pdwCurrentBrightness, out uint pdwMaximumBrightness);
private static extern bool GetMonitorCapabilities( SafePhysicalMonitorHandle hMonitor, out MC_CAPS pdwMonitorCapabilities, out MC_SUPPORTED_COLOR_TEMPERATURE pdwSupportedColorTemperatures);