Envy 17 Brightness Hotkey Work-around

My new laptop, 2xxxx series HP Envy 17 3D has a small problem if you update the ATI graphics drivers, namely: the Brightness hot keys stop working.

What to do? Well step in www.Notebookreview.com forums, and the HP Envy 17 (2xxx) series Owners Lounge and a work-around pointed out by Fiver5-

Fiver5 pointed me to a display brightness gadget over at edgylogic - Who happen to also share his source code for his console application, this combined together with AutoHotKey , and we have brightness functions working again! Woot! But now for the point of my post - tweaking!

The console application allows you to set the brightness value of the screen with a command line argument, but does not allow you to increment up and down automatically...

Pretty simple fix, just need to add two command line arguments to the console application, and then change the window behavior to not display the console when the application is launched:

Here's the additions to the original code, not the cleanest i know, but hey, it works:
/* inc up */
else if (args[0] == "-up")
{
byte[] BrightnessLevels = GetBrightnessLevels();
byte CurrentBrightnessLevel = GetBrightness();
int SetNextLevel = 0;

foreach (byte b in BrightnessLevels)
{
if (CurrentBrightnessLevel == b)
{
SetNextLevel = 1;
}
else if (SetNextLevel == 1)
{
SetBrightness(b);
SetNextLevel = 0;
Console.WriteLine("0"); //success value
}
}
}
/* inc down */
else if (args[0] == "-down")
{
byte[] BrightnessLevels = GetBrightnessLevels();
byte CurrentBrightnessLevel = GetBrightness();
byte PreviousLevel = 0;
int SetNextLevel = 0;

foreach (byte b in BrightnessLevels)
{
if (CurrentBrightnessLevel == b)
{
SetNextLevel = 1;
}
else
{
PreviousLevel = b;
}

if (SetNextLevel == 1)
{
SetBrightness(PreviousLevel);
SetNextLevel = 0;
Console.WriteLine("0"); //success value
}
}
}
Auto Hot Key script:
^F2::Run %A_WorkingDir%\laptopBrightness.exe -down
^F3::Run %A_WorkingDir%\laptopBrightness.exe -up
This script launches the modified laptopBrightness.exe console from the same working directory that the script is ran from, and when you press ctrl+f2 and ctrl+f3 it launches the program with the command -down and -up respectively.

Here is the files compiled and attached here - with the source code included.

Install instructions:
  1. Download the application here: http://www.mediafire.com/file/k419mlat7c80fc4/BrightnessHotKey.zip
  2. Move the files into the same directory, such as:
    C:\BHK\LaptopBrightness.exe
    C:\BHK\BrightnessHotKey.exe
  3. Vista/7 users - I didn't Sign my program, so when you first launch LaptopBrightness.exe you will have to uncheck "Always ask before opening this file" when prompted by the security warning.
  4. Go to your windows start up directory, make a shortcut to BrightnessHotKey in it (do not copy it there, just make a short cut to it), now every time you boot up the hotkey will activated and you should be good to go!

This work around should work for other laptop brands/companies, but YMMV :)

My testing has shown that this work around works in video games such as World of Warcraft, Counter Strike : Source and Call of Duty : Modern Warfare 2. You can hold down ctrl+f3 to quickly go up in brightness, and the same to go down.

Questions/Comments? Please please leave them below!

Comments

Popular posts from this blog

CI Build broke after nugit update

Sharepoint 2007 - Access Denied when you try to edit

Project 2010 and Project Pro 2007