function GetMonitorBrightness(hMonitor: HMONITOR;
pdwMinimumBrightness: PDWORD;
pdwCurrentBrightness: PDWORD;
pdwMaximumBrightness: PDWORD): boolean;
stdcall; external 'Dxva2.dll' Name 'GetMonitorBrightness';
type
LPPHYSICAL_MONITOR = record
hPhysicalMonitor: THandle;
szPhysicalMonitorDescription: array [0..127] of widechar;
end;
PLPPHYSICAL_MONITOR = ^LPPHYSICAL_MONITOR;
function GetPhysicalMonitorsFromHMONITOR(HMONITOR: HMONITOR;
dwPhysicalMonitorArraySize: DWORD;
pPhysicalMonitorArray: PLPPHYSICAL_MONITOR): boolean;
stdcall; external 'Dxva2.dll' Name 'GetPhysicalMonitorsFromHMONITOR';
function GetNumberOfPhysicalMonitorsFromHMONITOR(HMONITOR: HMONITOR;
pwNumberOfPhysicalMonitors : PDWORD): boolean;
stdcall; external 'Dxva2.dll' Name 'GetNumberOfPhysicalMonitorsFromHMONITOR';
h := Screen.Monitors[0].Handle;
DebugLn(['Monitor handle ', h]);
DebugLn('');
GetNumberOfPhysicalMonitorsFromHMONITOR(h, @NoOfPhyicalMonitors);
Debugln(['GetNumberOfPhysicalMonitorsFromHMONITOR ', SysErrorMessage(GetLastError)]);
DebugLn([NoOfPhyicalMonitors, ' monitors']);
DebugLn('');
GetPhysicalMonitorsFromHMONITOR(h, NoOfPhyicalMonitors, @pm);
Debugln(['GetPhysicalMonitorsFromHMONITOR ', SysErrorMessage(GetLastError)]);
DebugLn([pm.hPhysicalMonitor, ' ', pwidechar(@pm.szPhysicalMonitorDescription[0])]);
DebugLn('');
GetMonitorBrightness(pm.hPhysicalMonitor, @a, @b, @c);
Debugln('GetMonitorBrightness ', [SysErrorMessage(GetLastError)]);
Debugln(['Min ', a, ' Current ', b, ' Max ', c]);