In Vista and Win 7, you can press Win + X to use Windows Mobility Center to adjust your LCD backlight. Windows Mobility Center talks to your graphics driver.
I searched MSDN and found some articles talking about "Backlight Control Interface". But I just don't know how to implement this code into Autohotkey.
Can anyone help? The MSDN link is here:
<!-- m -->http://msdn.microsof.../aa372656(VS.85<!-- m -->).aspx

How to adjust display brightness? (I'm sure it's possible)
Started by
dvda2k
, Mar 25 2009 04:03 AM
26 replies to this topic
#1
-
Posted 25 March 2009 - 04:03 AM

[OT]
OK. We often see 'half-converted' URLs used within the forum, like the following one (taken from above):
http://msdn.microsof...ibrary/aa372656(VS.85).aspx
The reason is the use of special characters, here ---> ( ), which won't be translated by the forum software phpBB. A quick one to help yourself is to drop the link into Google and search for it. You can extract the (now) converted special characters afterwards from the (converted) link which is shown at the address bar.
http://msdn.microsof...ry ... 85).aspx
[/OT]
OK. We often see 'half-converted' URLs used within the forum, like the following one (taken from above):
http://msdn.microsof...ibrary/aa372656(VS.85).aspx
The reason is the use of special characters, here ---> ( ), which won't be translated by the forum software phpBB. A quick one to help yourself is to drop the link into Google and search for it. You can extract the (now) converted special characters afterwards from the (converted) link which is shown at the address bar.
http://msdn.microsof...ry ... 85).aspx
[/OT]
#2
-
Posted 25 March 2009 - 08:12 AM

OR ...
feel free to have a try to translate the string/URL with Autohotkey. 8)
feel free to have a try to translate the string/URL with Autohotkey. 8)
HTML, String: Converts String into its HTML equivalent by translating characters whose ASCII values are above 127 to their HTML names (e.g. £ becomes £). In addition, the four characters "&<> are translated to "&<>. Finally, each linefeed (`n) is translated to
`n (i.e.
followed by a linefeed).
#3
-
Posted 25 March 2009 - 08:17 AM

BoBo³, thanks for your reply. Fortunately the MSDN website has some error-proof feature, the broken URL still gets you to the right place.
Do you have any comment on my question itself?
Do you have any comment on my question itself?
#4
-
Posted 25 March 2009 - 09:30 AM

I humbly second that request for IOCTL_VIDEO_SET_DISPLAY_BRIGHTNESS
#5
-
Posted 25 September 2009 - 10:05 PM

hLCD = CreateFile( "\\.\LCD" , #GENERIC_READ | #GENERIC_WRITE , #FILE_SHARE_READ | #FILE_SHARE_WRITE , #Null , #OPEN_EXISTING , #Null , #Null ) DeviceIoControl( hLCD , #IOCTL_VIDEO_QUERY_SUPPORTED_BRIGHTNESS , #Null , #Null , MDB , SizeOf ( MDB ) , @ lReturnedBytes , #Null ) DeviceIoControl( hLCD , #IOCTL_VIDEO_SET_DISPLAY_BRIGHTNESS , SDB , SizeOf ( tDisplayBrightness ) , #Null , #Null , @ returnedBytes , #Null)
Can someone help me write the appropriate dllcall?
hLCD := DllCall("CreateFile", "str", "\\.\LCD", "Uint", 0, "Uint", 3, "Uint", 0, "Uint", 3, "Uint", 0, "Uint", 0) SUPPORTED_BRIGHTNESS := DllCall("DeviceIoControl", "Uint", hLCD, "Uint", 0x125, "Uint", 0, "Uint", 0, "str", 0, "str", 256, "Uint", 0, "Uint", 0)
#6
-
Posted 26 September 2009 - 11:52 AM

Does this work (I don't have an LCD monitor to test)? If not, what does the msgbox show?
hLCD := DllCall("CreateFile" , Str, "\\.\LCD" , UInt, 0x80000000 | 0x40000000 ; GENERIC_READ | GENERIC_WRITE , UInt, 0x1 | 0x2 ; FILE_SHARE_READ | FILE_SHARE_WRITE , UInt, 0 , UInt, 0x3 ; OPEN_EXISTING , UInt, 0, UInt, 0) if hLCD <> -1 { FILE_DEVICE_VIDEO := 0x00000023, METHOD_BUFFERED := 0, FILE_ANY_ACCESS := 0 VarSetCapacity(DISPLAY_BRIGHTNESS, 3, 0) NumPut(0x03, DISPLAY_BRIGHTNESS, 0, "UChar") ; 0x01 = Set AC, 0x02 = Set DC, 0x03 = Set both NumPut(50, DISPLAY_BRIGHTNESS, 1, "UChar") ; The AC brightness level NumPut(50, DISPLAY_BRIGHTNESS, 2, "UChar") ; The DC brightness level Msgbox % "" . DllCall("DeviceIoControl" , UInt, hLCD , UInt, (FILE_DEVICE_VIDEO<<16 | 0x127<<2 | METHOD_BUFFERED<<14 | FILE_ANY_ACCESS) ; IOCTL_VIDEO_SET_DISPLAY_BRIGHTNESS , UInt, &DISPLAY_BRIGHTNESS, UInt, 3 , UInt, 0, UInt, 0 , UIntP, dwBytesReturned ; Unused. , UInt, 0) "`nErrorLevel:`t`t" ErrorLevel "`nLastError:`t`t" A_LastError DllCall("CloseHandle", UInt, hLCD) }(based on this code (remarks))
#7
-
Posted 26 September 2009 - 12:45 PM

Doesn't work 
I am on a desktop LCD (AC power). Don't have a laptop.
Msgbox Output:

I am on a desktop LCD (AC power). Don't have a laptop.
Msgbox Output:
1 Errorlevel : 0 Last Error: 0
#8
-
Posted 26 September 2009 - 01:16 PM

Same output and no effect. Perhaps my LCD doesn't support backlight control.
Can anyone else test this too?
Can anyone else test this too?
#10
-
Posted 26 September 2009 - 01:35 PM

Thanks for al the help temp0
. I hope we figure this out someday.

#11
-
Posted 26 September 2009 - 04:49 PM

1
Errorlevel : 0
Last Error: 0
Same here. I can adjust my laptop LCD brightness with fn+f9/f10, but AHK cannot detect the 'fn' key (no sc/vk code) so I cannot remap it -- I'd prefer to use the mouse scroll wheel...
#12
-
Posted 26 September 2009 - 09:21 PM

Hardware: fast laptop with SSD
Software: Win 7 Home Premium 64-bit, android for phone and tablet
#13
-
Posted 26 September 2009 - 11:00 PM

Any ideas how to call DxgkDdiSetBrightness from AutoHotkey? (more info here)
IOCTL is deprecated in Vista/7 and mostly doesn't work anyway, but this method should be the same which is used in the mobility center.
Thanks.
IOCTL is deprecated in Vista/7 and mostly doesn't work anyway, but this method should be the same which is used in the mobility center.
Thanks.
#14
-
Posted 06 September 2010 - 06:15 PM

Sorry to post in this old thread but I'm also looking for this solution.
The Fn keys on my laptop are signaled at BIOS level or something and seem impossible to remap using the HID DLL method to identify the keys.
Windows Mobility Center has a GUI brightness slider that corresponds to the same function, brightness up/brightness down. Can this be mapped to a hotkey?
The Fn keys on my laptop are signaled at BIOS level or something and seem impossible to remap using the HID DLL method to identify the keys.
Windows Mobility Center has a GUI brightness slider that corresponds to the same function, brightness up/brightness down. Can this be mapped to a hotkey?
#15
-
Posted 20 October 2010 - 02:56 PM
