I am trying to write a simple console application for Windows 10 that changes the screen brightness. Ultimately, I want to use this application with AutoHotKey, but this is secondary.
In researching this, almost everything I found referred to Android, which doesn't help. I did find this Q&A about changing the screen brightness with C, but unfortunately that is for Linux.
This archived thread contains a script that (while appearing quite hacky) makes a good impression - but it
is deprecated, and on many [Systems] it will not return the full brightness settings array. So, where you should have 8 levels, IOCTL_VIDEO_QUERY_DISPLAY_BRIGHTNESS will only return 6, or none at all. (by jkiel, 1)
So I would prefer to use the WmiMonitorBrightness
class (2 3) over IOCTL_VIDEO_QUERY_SUPPORTED_BRIGHTNESS
. It also provides a lot finer granularity, but I lack the skills to implement it correctly.
So how can I change the screen brightness on Windows 10? Possibly using the mentioned WmiMonitorBrightness
class? I don't mind if it is a C application, an AutoHotKey script or something else, that I can control from console.