Drive:Activated logo
Project sign

Display Brightness Vista Gadget

   Last updated: Nov 13 2007, 03:59 PM (Over 33 months ago)   

UPDATE (18/12/2008): Fixed a small bug where displays with a maximum display level of less than 100 were not scaled properly for display in the gadget (see comments). Now v1.1.0.0.

UPDATE (18/11/2008): I have added a download for the console app and code that adjusts the display brightness, as used by the gadget.

What's this?

Another Windows Vista gadget, that's what. It allows you to change your laptop's screen brightness with a click of the mouse from the sidebar.

Once you install this gadget, just hover over it and it'll tell you the allowed brightness levels on your display. Click, and your monitor brightness will change. Simple.

The process of changing the monitor's brightness may take a few seconds, so the sun icon on the gadget will blink to tell you it's doing something Smile.

Sometimes the current brightness reported by the gadget may be different to the actual brightness because of changes by other actions/programs (e.g. disconnecting/connecting power, or using Windows Mobility Center to adjust). Just give it a minute or two and it'll update itself again. The gadget is still fully operable when it's out of sync.

Why?

I got sick of having to call up the Windows Mobility Center each time I wanted to change my screen's brightness on my tablet (the keyboard function keys don't work unless I load the Toshiba Flash Cards thingy, which is nice when it works, but is slow and takes up too much memory).

What are the technical tidbits?

This gadget combines a bit of everything - javascript for the gadget logic, VBScript to get the monitor brightness details, and C# (.NET) to set the monitor brightness.

Why javascript for the gadget logic? Because I like javascript better than VBScript when manipulating HTML elements (the real answer being I know more javascript).

So why not use JScript to get the monitor brightness details? Because in the case of using access Windows methods and commands (and using WMI), I know more VBScript in that area and there is more support out there for it, given VBScript is Windows' main automation language (soon to be replaced by PowerShell I think).

And finally, why another language to set the monitor brightness? Because neither VBScript or JScript can handle the 64-bit integers required by the WMI method (and there doesn't seem to be a workaround method available). So I wrote a small console app in C#, and the gadget's VBScript simply runs that and passes a parameter telling it what brightness level to set it to.

Show me the goods!

Just so you're sure - this gadget requires Windows Vista. It won't work on anything else.

The download link is below - to install, simple double-click on the downloaded .gadget file. One more thing - if the file you downloaded does not end with .gadget, and instead ends with .zip or anything else, you must rename the file to end with .gadget or the gadget will not install. Otherwise, when you double-click on the file, you'll either see rubbish, or a zip folder full of XML, HTML and graphic files.

As usual, drop me a note if you have any problems, or suggestions. And let me know if you want the source code/binary to the console app - the rest you can get by simply unzipping the .gadget file.

Download: Display Brightness Vista Gadget

But I want the stuff behind-the-scenes!

I've gotten a few requests on code that does the heavy lifting, particularly the C# console app, so here it is -  Display Brightness Console App. This is not required for the gadget to work.

Both the code (C#) and the compiled exe are in the zip file. You will need the Microsoft .NET Framework 2.0 or greater for the app to work (Vista comes with 2.0 out of the box). It will only work in Windows Vista - as far as I know, there is no standard way to change display brightness programmatically in Windows XP.

To use the console app, the following parameters are allowed:

  • DisplayBrightnessConsole.exe
    This will return the current brightness level.
  • DisplayBrightnessConsole.exe -getlevels
    This will return all possible brightness levels accepted by the display, separated by a new line.
  • DisplayBrightnessConsole.exe 20 (or some other brightness level number)
    This will set the brightness level of the display to the parameter given, in this case, 20.
The code currently only works on single-display systems. If your system has more than one display, it will only work on the first (generally primary) display. It should be fairly easy to modify it to support more.
Trackbacks sign
1 Trackback
Trackback URL
Comment sign
Drive:Activated tracked back:

I'm at it again - another Vista gadget. This time I got sick of having to open up Windows Mobility

Comments sign
57 Comments
Comments RSS RSS icon
Comment sign
Misheck Gatana said:

My Toshiba laptop is on windows vista. Whenever I switch on the screen has always been brighter than I would like. Controlling brightness from the Vista is slow. I downloaded the windows vista gadget and found it works faster. I am impressed by your initative.

Comment sign
Sam said:

Misheck:

You can permanently change the default brightness of your Vista laptop - rather than change it each time via the gadget or Windows Mobility Center.

To do this, go to Control Panel -> Power Options. Then down the left side, click on adjust display brightness. Change the setting there and press save changes. The setting you set there will now be the default brightness of your display.

Comment sign
Wayne said:

Thank's for this program it saves me a lot of time ,and it's one of my favorites, thank's agin very useful

Comment sign
Meshue said:

Yea, you can dim your screen quickley when you step away from your computer, and save your laptop screen from burning out, lasting longer.

 Thank,s

Comment sign
Sunil said:

iam using sony vaio, still the brightness is not controlled. Can anyone help ??

Comment sign
Faisal said:

Thank you very much Sam. Your suggestion completely addressed my issue.

Comment sign
Sam said:

Sunil:

Do you see the different available brightness levels in the gadget (move your cursor over it from left to right and see if the numbers change)?

Comment sign
Amitabh said:

It seems like it has a great lot of potential. Since my tablet has a small screen, if you can make the gadget smaller in size, that would be great. I, and I expect some other people, would appreciate it a great deal!

Comment sign
chris said:

Thanks.    

Why not just make the download file a .gadget extension,  or put a readme file in the .zip file, I figured it out when I came back and read what I should have before downloading, lol.   I think for some new vista users, they may not know how to change extensions.  Thank you again, this will be my most used gadget.  

Comment sign
saad said:

ds

Comment sign
Alonso said:

i have tried run it, but it doesent work, it just opens a CMD console and closes allmost imediatly, what can i do??

Comment sign
Sam said:

chris:

It actually does have a .gadget extension, except my blog software was too smart for its own good, detected it's a zip file and tells browsers it's that instead.

I was too lazy to work out how to fix it before, but I've finally done it. The download should work fine now.

Thanks for prodding me into action :)

Alonso:

Try downloading it again - you might have downloaded a mangled copy due to the problem above.

Comment sign
Tim said:

Hey Sam,Downloaded your gadget because I have no "brightness tile" in mobility center(Latitude 630). Your tile, on my sidebar, has no sunshine. Just a black rectangular box. Help!

Comment sign
Tim said:

Hey Sam,Downloaded your gadget because I have no "brightness tile" in mobility center(Latitude 630). Your tile, on my sidebar, has no sunshine. Just a black rectangular box. Help!

Comment sign
Sam said:

Tim:

Hmm, from what I can gather, your machine has an ambient brightness sensor that is designed to change the display brightness automatically. Dell may have set up your computer such that it overrides the standard way of changing display brightness, rendering the widget useless.

From what I can gather in the following paragraph, using Dell's Quick Set software maybe the only other way to change your display brightness. Or maybe there are buttons on your keyboard that do the same?

"One unusual feature of the D630 is also related to the display, with a light sensor embedded into the bezel allowing for automatic adjustment according to the brightness of your environment. Dell's Quick Set software allows you to change your preferences, creating maximum and minimum preferred brightness levels, and all in all it's a nice time saving feature for everyday use."

Comment sign
Ryan said:

Hey Sam.  I love this option!  Using my computer in different light or at different times of the day requires different brightness.  I have been using this since the first of the year and have not had a single problem with it until yesterday.  It just stopped working.  It shows up blank and doesn't say anything about what's wrong.  I have reloaded it and still no luck.  Any ideas?

Comment sign
Sam said:

Ryan:

Have you tried rebooting the computer? No external monitor connected? If it shows up blank (i.e. a grey box), it means it can't read the valid brightness levels from your computer. Sometimes Windows just refuses to co-operate :)

It randomly occurs on my system, so it's hard to fix.

Comment sign
Ryan said:

Hey Sam!  I rebooted the computer a bunch of times and finally just gave up for a few days.  When I came back and tried to use it again, it worked! I guess it was just windows refusing to co-operate like you said.  Working fine again!  Keep up the good work and thanks for the quick response!

Comment sign
Stephanie said:

Exactly what I was looking for and works sooooo well.  Thank you so much!!!!

Comment sign
ika said:

tidak ada

Comment sign
ika said:

tdk ada

Comment sign
ave0000 said:

Thank you for writing this gadget.  I don't use the sidebar myself, but your DisplayBrightnessConsole.exe is a very useful little program.  I plan to use it with another program called "AutoHotkey" To use my FF/Rew keys to change brightness.  The fact that it returns the current brightness (or zero) is extremely useful.

Comment sign
chris said:

it doesnt work for me i installed it and its balnk on the side bar plz help me

i had windows xp and then changed it to vista eveything works good execpt tht my Fn buttons dont work and my screen is really dim

Comment sign
Sam said:

Chris -

Does the brightness control work inside the Windows Mobility Center (Start -> Programs -> Windows Mobility Center)?

ave0000 -

People seem really interested in that exe and the code. I'll be posting it up separately later, so it's easier to find.

Comment sign
Jo said:

This is fantastic, exactly what I needed!! Thank you so much, you're a genius! :)

Comment sign
Gregory said:

It appears that my brightness controls on my Motion LE1700 tablet go from 0-15 (not 0-100). The gadget works perfectly, but it's a small slider area. Any way to change it so 0-15 covers the whole thing? or make 0-100 relative to 0-15?

Comment sign
gregoryx said:

forgot to add my email for follow-up...

Comment sign
German Velasquez said:

Hi! i was using your amazing gadget on vista, i have a vaio, and i found it very useful for me, but now i downgraded my vaio to xp, and your gadget not works, i know... the sidebar, but the console app also doesn't works.... would you port your application to xp????...or make a little GUI on xp...PLEASE!!!!... i know i'm talking for everybody who owns a vaio.... thank you, in advantage...

I'll stay tunned for your answer...

German

Comment sign
lamoor said:

I have downloaded the gadet it is on my side bar but does not work just a black screen. I have vista and in the mobility center there is no brightness box either. My laptop is a samsung q45 and the brightness used to work with fn hot key and arrows. My screen is dim all the time now. Sometimes comes bright but then if I go to battery mode it goes dim again. thank you so much please help me.

Comment sign
Sam said:

German:

Are you sure the console app doesn't work? What happens instead, any errors? You do need to have .NET Framework 2.0 installed by the way (it comes pre-installed on Vista).

I'm unlikely to do anything on XP, because the keyboard adjustment support is what I'd rather use on that. A crude way of making things easier would be to get the console app working (should work), and then create shortcuts for every brightness level, put them in a folder, and dock it to your start menu.

lamoor:

Weird. Did it ever work? Have you updated the video or display drivers lately? Check that there are no problems in your device manager (Start -> Control Panel -> System -> Device Manager). You can adjust the default brightness in both power and battery mode in Start -> Control Panel -> Power Options -> Adjust display brightness.

Comment sign
German Velasquez said:

Hi, i was reading on the internet and the why the app doesn't works on xp is: MS had changed all the routines of the framework, xp is different to vista on some commands, in MSDN you can found this, i don't remember the link, but you can find it there, i was trying to modify your source code, but no success... .NET and me aren't friends... more likely perfect unknowns....jajajaja, thank you for the solution, i'll try it. Another solution is, have you think about to port  your gadget to yahoo widgets?? could be a useful solution... sorry for not to send you the MSDN link, but i'm on a hurry! i'll be tuned here!.

Comment sign
Sam said:

German:

You're right - the method of accessing and changing the display brightness I'm using only exists in Vista. Before Vista, there was no standard way of changing display brightness in Windows. So it'll probably be fairly difficult to do something similar on XP that works on many displays.

Looks like you'll have to stick with the tool than came with your laptop :(

Comment sign
Edio said:

I have problems with my Windows Mobility Center, don't show me the brightness control. Do you know as resolve this problem?

Comment sign
Teo T said:

thank you very much. im new in vista so it was kinda a revelation to find out (my one of the above comments) that brightness was hidden in power settings.. anyway. Great gadget, thnx for sharing

Comment sign
Drake Sol said:

I just downloaded it and avira sent it to quarantine due to some malicious code. What were you trying to pull with this one, you naughty boy?

Comment sign
Sam said:

Drake Sol:

I just ran the file through VirusTotal (www.virustotal.com/.../10a04432c9eb53c1ccc08c2110eb797c) - the website scans files using a range of antivirus programs - and it confirmed what you said, i.e. Avira is reporting a virus. If you visit the analysis page though, notice that only Avira and SecureWeb-Gateway are reporting a virus, HTML/Rce.Gen and Heuristic.Script.Rce (different names for the same thing).

If you look at the virus description (www.avira.com/.../html_rce.gen.html) you will see that it thinks it has found a virus because it found code that reads and modifies system properties using scripts in a HTML file. Nothing specific, just something that could be bad.

And normally, that is bad. However, Vista gadgets are written in HTML, and in this case, the code needs to read and modify system properties in order to show and change the display brightness.

I'm confident the code won't do anything destructive, and I'm also sure that no viruses have crept into the gadget.

But at the end of the day, it's up to you. I can't say/do anything more to make you trust the download. I also can't change the way the gadget works to bypass this warning, because it is the only way to do it with Vista gadgets. I suspect other gadgets which change system properties/behaviour will get a similar warning.

Comment sign
dante said:

i have a problem with my acer aspire corporated with microsoft windows vista home premium. after i use it about 2 month the display changing to over brightness. i tried 'everything' in the way to make it back to the beginning i buy it but nothing happened. do you have any suggestion?

Comment sign
Praveen said:
Comment sign
alexander said:

works flawlessly with my sony vaio.

good job!!

Comment sign
Everett said:

Its fine.Everett

Comment sign
Everett said:

Its fine.Everett

Comment sign
Yorgen said:

Good gadget. Worked on W7.

Comment sign
Fernando said:

Thank you very much for this excellent app and gadget, my notebook is a vaio vg-cr150 and sony does not have support for windows 7 (the fn keys does not work)... this worked like a charm!!!

Comment sign
Fernando said:

Thank you very much for this excellent app and gadget, my notebook is a vaio vg-cr150 and sony does not have support for windows 7 (the fn keys does not work)... this worked like a charm!!!

Comment sign
MIke said:

I'm lovin this ap.  I loaded win7 on my vaio and the hotkey drivers were not available for the 64 bit upgrade I did. I had to click on the dumb little battery and select change screen brighness everytime before this.

Thanks!

Comment sign
devesh said:

works on 7 vaio jst fine....good utility to have....superb...

Comment sign
ady said:

good job ...i love it

Comment sign
Loren Amelang said:

Would it be possible to add a function to Enable or Disable the Ambient Light Sensor (ALS) in Windows7? Microsoft says using any manual brightness setting disables ALS, and it must be manually re-enabled to get control again. I have your gadget set up in AutoHotkey to force manual brightness changes, but I can't find a way to use AHK to switch back to ALS. Actually what I see on my Motion J3400 is that they compete with each other (unless the manual setting is all the way up or down, which seems to lock out ALS), so there may be more going on...  Any Thoughts?

Comment sign
Daniel said:

Sam, you ROCK.  This gadget has saved what remains of my hair from being torn out - it was driving me nuts having to fish around in Windows 7 Mobility Center (yep, it's a problem in Win7 as well).

Just one question.  One of my laptops doesn't allow me to change the brightness at all; all the options are gone, even from Mobility Center. Used to work fine though so it's not a hardware issue.  Your gadget also doesn't work on this laptop.  Any ideas where the problem could lie?

Cheers, Dan

Comment sign
Ian said:

Sam, I can't get it to work on Asus T91 with Win7.  It shows levels 1 - 15, yet when I use the keyboard function key to set maximum brightness, your gadget reports 71.  If I use your app to set the brightness to 71 it still only stays at 15.

Am I doing something wrong? Is it incompatible with Asus drivers?

Comment sign
Seth said:

Lately, the gadget still works for adjusting the brightness but not for displaying the current brightness level (adjusted via another control). Is there a fix? Windows Mobility Center brightness meter still works properly. I'm running Windows 7 x64 with Mobile Intel Graphics Series 4.

Comment sign
Loren Amelang said:

As Seth said, it looks like the desktop gadget doesn't see changes made by other methods. I'm using AutoHotKey to trigger your ConsoleApp to change brightness, which saves my sanity dozens of times a day. I hadn't noticed that the gadget display doesn't follow along.

Not sure if it ever did. It just sits there at the setting in use when it opened. It still also changes brightness, and reports its own changes correctly, except I can't set it to zero! Ten is the lowest setting it makes available. Zero works fine from the ConsoleApp.

Motion J3400 tablet, LCD backlight, 32-bit Win7pro.

Want a strange bug? In Google Chrome, I can't place the cursor in the bottom two lines of this pane by clicking! The pointer reverts to the selection arrow when I go below the third line up. I can click up there and use arrow keys to bring the cursor down...  

Except now after scrolling back to the top of this pane and then back down, the cursor behaves normally! Maybe you have to type more to auto add more lines? Well, not so far...  

I give up - can't reproduce it. But it was definitely happening!

Comment sign
Aman said:

Works well on HP Touchsmart tm2 win 7 - perfect for adjusting brightness easily whn in tablet mode!  If you ever decide to improve it, would be worth having options to change size, maybe have a small slidebar, and also to change colours.  Well done!

Comment sign
Aman said:

Actually one minor bug - if brightness is changed by system (e.g. on changing power plan) or by me using physical brightness keys or system softrware, the brightness in the gadget does not change to match.  Still, only a minor bug and still a useful app :-)

Comment sign
Aman said:

Actually, minor bug - if the brightness is changed by the system (e.g. power plan change) or using the system software or hardware buttons, the gadget brightness does not change to match (e.g. still shows 80% even when lowered).  No real matter though, still a simple yet very useful app :-)

Comment sign
Aman (again) said:

Actually, minor bug - if the brightness is changed by the system (e.g. power plan change) or using the system software or hardware buttons, the gadget brightness does not change to match (e.g. still shows 80% even when lowered).  No real matter though, still a simple yet very useful app :-)

Comment sign
Aman (again) said:

Actually, minor bug - if the brightness is changed by the system (e.g. power plan change) or using the system software or hardware buttons, the gadget brightness does not change to match (e.g. still shows 80% even when lowered).  No real matter though, still a simple yet very useful app :-)

Post comment sign
Leave a Comment
I know you want to!
(required)  
(optional)
(required)  

Want to keep stay in the loop with the comments here? Leave your email address below and you'll be informed when a new comment is added to this blog post.

(optional):  

Submit