PDA

View Full Version : Programmatically Controlling Backlight Brightness


csobsidian
17th October 2008, 02:57 PM
I am trying to write a Today screen item that will allow a user to quickly change the backlight dimmer level (i.e. hit a button go to x% hit another button go to y%). I have been able to find plenty of information regarding device power states and turning on and off the backlight, but nothing what so ever on how to control the current dimmer level.

Could somebody point me in the right direction? Specifically I am hoping to find a low-level API function that I can easily hook into (which is what I would expect) and also related registry keys (which I assume are what's being used by the backlight control panel).

Thanks in advance!

N'da
17th October 2008, 04:03 PM
Look for MVBklight, it's a backlight app, really great with today plugin, pop up dimmer and cycling functions. Hope it helps you to do your own stuff.

csobsidian
17th October 2008, 06:48 PM
Thanks for the above link. I think I may have actually found an english version, but I still haven't given up programming my own today item (especially since I want to learn the ins and outs of Today Screen items in general).

I think I've narrowed it down to the following

// Get a handle to the LCD device.
hLCD = CreateFile(TEXT("\\.\LCD"), blah, blah);

// Get the display brightness
DeviceIoControl(hLCD, IOCTL_VIDEO_QUERY_DISPLAY_BRIGHTNESS, blah, blah);

The problem I am having now is that when I specify the above device (\\.\LCD) I get a file not found error. I have a feeling that the device name may actually be different (even though this was an example given on MSDN it was for a laptop LCD i believe). How do I know that this is the proper name for the device? Is there a way to enumerate device names? Do I have to create a link for a device name to a device?

Thanks again.