0

I'm trying to find a way to set screen brightness programmatically. Some existing SO answers point to this article. However, when I try executing Powershell code from that article, I get errors:

Get-CimInstance -Namespace root/WMI -ClassName WmiMonitorBrightnessMethods

Get-CimInstance : Not supported At line:1 char:1 + Get-CimInstance -Namespace root/WMI -ClassName WmiMonitorBrightnessMe ... + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotImplemented: (root/WMI:WmiMonitorBrightnessMethods:String) [Get-CimInstance], CimExce ption + FullyQualifiedErrorId : HRESULT 0x8004100c,Microsoft.Management.Infrastructure.CimCmdlets.GetCimInstanceCommand

There must be some other way because there are programs that can do this.

P. S. I'm experimenting/developing on a desktop, but my target PC where I will actually use this feature is a tablet, so I'll prefer if I was actually able to control the backlight brightness rather than simply making the image darker.

Violet Giraffe
  • 32,368
  • 48
  • 194
  • 335
  • 1
    You'll have to reach a bit, there is usually a little joystick-style button on the monitor. The "other programs can do this" claim is overrated, especially on a desktop machine. Google IOCTL_VIDEO_QUERY_SUPPORTED_BRIGHTNESS to get started, ought to show some SetDeviceGammaRamp hits as well. – Hans Passant Mar 09 '16 at 14:50
  • 1
    @HansPassant: yep, found `SetDeviceGammaRamp` - works perfectly (on the one machine where I tested it so far) and easy to understand. As for reaching... I need it for a car PC to adjust screen brightness based on time of day. Do you really want me to reach and start tapping the screen while driving? ;) – Violet Giraffe Mar 09 '16 at 14:55
  • Do you really need me to tell you not to use a PC while driving? Automatic adjustment based on ambient light picked up by the camera is a built-in feature. – Hans Passant Mar 09 '16 at 14:56

0 Answers0