끄적끄적

반응형

www.autohotkey.com/board/topic/83100-laptop-screen-brightness/

 

Laptop Screen Brightness - Scripts and Functions

Laptop Screen Brightness - posted in Scripts and Functions: Not wanting to take the time to understand Autohotkey variable scopes, this is a bit of a hack.Most/all of the screen brightness AHK scripts Ive found using IOCTL_VIDEO_SET_DISPLAY_BRIGHTNESS seem

autohotkey.com

 

www.autohotkey.com/board/topic/39004-how-to-adjust-display-brightness-im-sure-its-possible/

 

How to adjust display brightness? (I'm sure it's possible) - Ask for Help

Page 1 of 2 - How to adjust display brightness? (Im sure its possible) - posted in Ask for Help: 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

autohotkey.com


 

#NoEnv
#AllowSameLineComments
#SingleInstance force
#InstallKeybdHook
;#NoTrayIcon

SetWorkingDir %A_ScriptDir%
SendMode, Input

SC108::  ; SAMSUNG brightness up FN key
MoveBrightness(1)
return

SC109::  ; SAMSUNG brightness down FN key
MoveBrightness(-1)
return

;#a::
;MoveBrightness(1)
;return

;#z::
;MoveBrightness(-1)
;return


;############################################################################
; Functions
;############################################################################

MoveBrightness(IndexMove)
{

	VarSetCapacity(SupportedBrightness, 256, 0)
	VarSetCapacity(SupportedBrightnessSize, 4, 0)
	VarSetCapacity(BrightnessSize, 4, 0)
	VarSetCapacity(Brightness, 3, 0)
	
	hLCD := DllCall("CreateFile"
	, Str, "\\.\LCD"
	, UInt, 0x80000000 | 0x40000000 ;Read | Write
	, UInt, 0x1 | 0x2  ; File Read | File Write
	, UInt, 0
	, UInt, 0x3  ; open any existing file
	, UInt, 0
	  , UInt, 0)
	
	if hLCD != -1
	{
		
		DevVideo := 0x00000023, BuffMethod := 0, Fileacces := 0
		  NumPut(0x03, Brightness, 0, "UChar")   ; 0x01 = Set AC, 0x02 = Set DC, 0x03 = Set both
		  NumPut(0x00, Brightness, 1, "UChar")      ; The AC brightness level
		  NumPut(0x00, Brightness, 2, "UChar")      ; The DC brightness level
		DllCall("DeviceIoControl"
		  , UInt, hLCD
		  , UInt, (DevVideo<<16 | 0x126<<2 | BuffMethod<<14 | Fileacces) ; IOCTL_VIDEO_QUERY_DISPLAY_BRIGHTNESS
		  , UInt, 0
		  , UInt, 0
		  , UInt, &Brightness
		  , UInt, 3
		  , UInt, &BrightnessSize
		  , UInt, 0)
		
		DllCall("DeviceIoControl"
		  , UInt, hLCD
		  , UInt, (DevVideo<<16 | 0x125<<2 | BuffMethod<<14 | Fileacces) ; IOCTL_VIDEO_QUERY_SUPPORTED_BRIGHTNESS
		  , UInt, 0
		  , UInt, 0
		  , UInt, &SupportedBrightness
		  , UInt, 256
		  , UInt, &SupportedBrightnessSize
		  , UInt, 0)
		
		ACBrightness := NumGet(Brightness, 1, "UChar")
		ACIndex := 0
		DCBrightness := NumGet(Brightness, 2, "UChar")
		DCIndex := 0
		BufferSize := NumGet(SupportedBrightnessSize, 0, "UInt")
		MaxIndex := BufferSize-1

		Loop, %BufferSize%
		{
		ThisIndex := A_Index-1
		ThisBrightness := NumGet(SupportedBrightness, ThisIndex, "UChar")
		if ACBrightness = %ThisBrightness%
			ACIndex := ThisIndex
		if DCBrightness = %ThisBrightness%
			DCIndex := ThisIndex
		}
		
		if DCIndex >= %ACIndex%
		  BrightnessIndex := DCIndex
		else
		  BrightnessIndex := ACIndex

		BrightnessIndex += IndexMove
		
		if BrightnessIndex > %MaxIndex%
		   BrightnessIndex := MaxIndex
		   
		if BrightnessIndex < 0
		   BrightnessIndex := 0

		NewBrightness := NumGet(SupportedBrightness, BrightnessIndex, "UChar")
		
		NumPut(0x03, Brightness, 0, "UChar")   ; 0x01 = Set AC, 0x02 = Set DC, 0x03 = Set both
        NumPut(NewBrightness, Brightness, 1, "UChar")      ; The AC brightness level
        NumPut(NewBrightness, Brightness, 2, "UChar")      ; The DC brightness level
		
		DllCall("DeviceIoControl"
			, UInt, hLCD
			, UInt, (DevVideo<<16 | 0x127<<2 | BuffMethod<<14 | Fileacces) ; IOCTL_VIDEO_SET_DISPLAY_BRIGHTNESS
			, UInt, &Brightness
			, UInt, 3
			, UInt, 0
			, UInt, 0
			, UInt, 0
			, Uint, 0)
		
		DllCall("CloseHandle", UInt, hLCD)
	
	}

}

 


위에 방법으로는 아직 안해봤다. 그냥 메모만..

 

제일 쉽게 하는 방법은 블루라이트 차단프로그램인 f.lux 프로그램을 설치해서 실행하고

Alt+PgUp, Alt+PgDn키로 조작하는 것이다.

반응형
Please Enable JavaScript!
Mohon Aktifkan Javascript![ Enable JavaScript ]