Answer the question
In order to leave comments, you need to log in
How to get current screen brightness via winapi?
Code:
HMONITOR hMonitor;
DWORD number=0;
DWORD min=1, max=2, cur=3;
PHYSICAL_MONITOR PhMonitor;
HANDLE hPhMonitor;
BOOL i;
const HWND hDesktop = GetDesktopWindow();
hMonitor = MonitorFromWindow(hDesktop, MONITOR_DEFAULTTOPRIMARY);
GetNumberOfPhysicalMonitorsFromHMONITOR(hMonitor, &number);
GetPhysicalMonitorsFromHMONITOR(hMonitor, 1, &PhMonitor);
hPhMonitor = PhMonitor.hPhysicalMonitor;
GetMonitorCapabilities(hPhMonitor, &min, &cur);
GetMonitorBrightness(hPhMonitor,&min,&cur,&max);
DestroyPhysicalMonitors(number, &PhMonitor);
GetMonitorBrightness gives ERROR_GRAPHICS_I2C_ERROR_TRANSMITTING_DATA, I have win 8.1
Everything works for a friend on win 10.
Is there any other way or possibility to fix this?
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question