wakillon Posted April 16, 2011 Share Posted April 16, 2011 (edited) It's late and Screen brightness hurts your eyesand you do not remember how you can regulate it ?I get a solution ! TinyBrightnessControlerLeft click on Tray Icon for show Controler and Right click for Tray Menu, that's all !expandcollapse popup#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_icon=Electric bulb1.ico #AutoIt3Wrapper_outfile=TinyBrightnessControler.exe #AutoIt3Wrapper_Res_Description=Adjust Screen Brightness #AutoIt3Wrapper_Res_Fileversion=1.0.0.2 #AutoIt3Wrapper_Res_Fileversion_AutoIncrement=p #AutoIt3Wrapper_Res_LegalCopyright=Copyright 2011 wakillon #AutoIt3Wrapper_Res_SaveSource=y ://////=__= ://////=__= #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #cs ----------------------------------------------------------------------------------------------------------- AutoIt Version : 3.3.6.1 Author : wakillon Based on the noctis Post : http://autoit.de/index.php?page=Thread&postID=83474#post83474 Title : TinyBrightnessControler Script Fonction : Adjust Screen Brightness. Left click on Tray Icon for show Controler and Right click for Tray Menu. #ce ----------------------------------------------------------------------------------------------------------- #include <WindowsConstants.au3> #include <GuiSlider.au3> Opt ( "TrayOnEventMode", 1 ) Opt ( "TrayMenuMode", 1 ) OnAutoItExitRegister ( "_Exit" ) Global Const $TRAY_UNCHECKED = 4 Global Const $TRAY_EVENT_PRIMARYDOWN = -7 Global $_Rgb, $_DefaultItem, $_GetPosOld, $_AboutItem, $_TitleItem, $_UpdateItem, $_SaveItem Global $_Gui, $_Slider, $_Label1, $_Label2, $_Dll Global $_Version = _GetScriptVersion ( ) _TrayMenu ( ) $_Rgb = RegRead ( "HKEY_LOCAL_MACHINESoftwareTBC", "Gamma" ) If $_Rgb = '' Then $_Rgb =128 $_GetPosOld=$_Rgb _SetGamma ( $_Rgb, $_Rgb, $_Rgb ) While 1 Sleep ( 10 ) WEnd Func _DisplaySlider ( ) Local $_MousePos = MouseGetPos ( ) Local $_GuiWight= 50, $_GuiHeight=230 Local $_Gui = GUICreate ( "", $_GuiWight, $_GuiHeight, $_MousePos[0]-$_GuiWight/2, @DesktopHeight - $_GuiHeight - _GetTaskbarHeight ( ) -2, _ BitOR ( $WS_POPUP, $WS_BORDER ), $WS_EX_TOPMOST, WinGetHandle ( AutoItWinGetTitle ( ) ) ) $_Label1 = GUICtrlCreateLabel ( "Min", 15, 10 ) $_Slider = GUICtrlCreateSlider ( 15, 30, 20, 180, BitOR ( $TBS_VERT, $TBS_TOOLTIPS, $TBS_AUTOTICKS ) ) GUICtrlSetLimit ( -1, 256, 0 ) $_Label2 = GUICtrlCreateLabel ( "Max", 15, 210 ) GUISetState ( ) _GUICtrlSlider_SetPos ( $_Slider, $_GetPosOld ) $_TimerInit = TimerInit ( ) While 1 $_GetPos = _GUICtrlSlider_GetPos ( $_Slider ) If $_GetPos <> $_GetPosOld Then $_Rgb = $_GetPos _SetGamma ( $_Rgb, $_Rgb, $_Rgb ) $_GetPosOld = $_GetPos $_TimerInit = TimerInit ( ) EndIf If _IsMouseOverCtrls ( $_Gui ) Then $_TimerInit = TimerInit ( ) $_TimerDiff = Round ( TimerDiff ( $_TimerInit )/ 1000 ) If $_TimerDiff > 2 Then ExitLoop WEnd GUIDelete ( ) EndFunc ;==> _DisplaySlider ( ) Func _IsMouseOverCtrls ( $_GuiHwnd, $_Active=0 ) $_CursorInfo = GUIGetCursorInfo ( $_GuiHwnd ) If Not @error Then Switch $_CursorInfo[4] Case $_Slider, $_Label1, $_Label2 Return 1 EndSwitch EndIf EndFunc ;==> _IsMouseOverCtrls ( ) Func _Normal ( ) TrayItemSetState ( $_DefaultItem, $TRAY_UNCHECKED ) $_Rgb = 128 $_GetPosOld = 128 _SetGamma ( $_Rgb, $_Rgb, $_Rgb ) EndFunc ;==> _Normal ( ) Func _Exit ( ) DllClose ( $_Dll ) Exit EndFunc ;==> _Exit ( ) Func _SetGamma ( $vRed=128, $vGreen=128, $vBlue=128 ) Local $n_ramp, $rVar, $gVar, $bVar, $Ret, $i, $dc If $vRed < 0 Or $vRed > 386 Then Return -1 If $vGreen < 0 Or $vGreen > 386 Then Return -1 If $vBlue < 0 Or $vBlue > 386 Then Return -1 $dc = DLLCall ( "user32.dll", "int", "GetDC","hwnd", 0 ) $n_ramp = DllStructCreate ( "short[" & ( 256*3 ) & "]" ) For $i = 0 to 256 $rVar = $i * ( $vRed + 128 ) If $rVar > 65535 Then $rVar = 65535 $gVar = $i * ( $vGreen + 128 ) If $gVar > 65535 Then $gVar = 65535 $bVar = $i * ( $vBlue + 128 ) If $bVar > 65535 Then $bVar = 65535 DllStructSetData ( $n_ramp, 1, Int ( $rVar ), $i ) ; red DllStructSetData ( $n_ramp, 1, Int ( $gVar ), $i+256 ) ; green DllStructSetData ( $n_ramp, 1, Int ( $bVar ), $i+512 ) ; blue Next $ret = DLLCall ( "gdi32.dll", "int", "SetDeviceGammaRamp", "int", $dc[0], "ptr", DllStructGetPtr ( $n_Ramp ) ) $dc = 0 $n_Ramp = 0 EndFunc ;==> _SetGamma ( ) Func _TrayMenu ( ) $_TempDir = @TempDir & 'TBCskin' If Not FileExists ( $_TempDir ) Then DirCreate ( $_TempDir ) If Not FileExists ( $_TempDir & 'Electric bulb1.ico' ) Then _ InetGet ( 'http://tinyurl.com/d3srkot', $_TempDir & 'Electric bulb1.ico', 9, 0 ) TraySetToolTip ( $_Version & @CRLF & @CRLF & '* Left click for show Controler' & @CRLF & '* Right click for Tray Menu' & @CRLF ) TraySetIcon ( $_TempDir & 'Electric bulb1.ico' ) TraySetClick ( 16 ) TraySetOnEvent ( $TRAY_EVENT_PRIMARYDOWN, '_DisplaySlider' ) $_TitleItem = TrayCreateItem ( $_Version ) TrayItemSetOnEvent ( -1, '_UnCheck' ) TrayCreateItem ( '' ) $_DefaultItem = TrayCreateItem ( 'Set Brightness To Normal' ) TrayItemSetOnEvent ( -1, '_Normal' ) TrayCreateItem ( '' ) $_UpdateItem = TrayCreateItem ( "See For Update" ) TrayItemSetOnEvent ( -1, '_SeeForUpdate' ) TrayCreateItem ( "" ) $_AboutItem = TrayCreateItem ( "About" ) TrayItemSetOnEvent ( -1, '_About' ) TrayCreateItem ( "" ) $_SaveItem = TrayCreateItem ( "Save Settings" ) TrayItemSetOnEvent ( -1, '_Save' ) TrayCreateItem ( "" ) $_ExitItem = TrayCreateItem ( 'Exit' ) TrayItemSetOnEvent ( -1, '_Exit' ) TraySetState ( 4 ) EndFunc ;==> _TrayMenu ( ) Func _Save ( ) TrayItemSetState ( $_SaveItem , $TRAY_UNCHECKED ) RegWrite ( "HKEY_LOCAL_MACHINESoftwareTBC", "Gamma", "REG_SZ", $_Rgb ) Msgbox ( 262144+4160, "Saved", "Gamma Settings have been saved", 3 ) EndFunc Func _SeeForUpdate ( ) TrayItemSetState ( $_UpdateItem , $TRAY_UNCHECKED ) ShellExecute ( 'http://www.autoitscript.com/forum/topic/127668-tinybrightnesscontroler/' ) EndFunc ;==> _SeeForUpdate ( ) Func _UnCheck ( ) TrayItemSetState ( $_TitleItem , $TRAY_UNCHECKED ) EndFunc ;==> _UnCheck ( ) Func _GetScriptVersion ( ) If Not @Compiled Then Return StringTrimRight ( @ScriptName, 4 ) & ' © wakillon 2010 - 2011' Else Return StringTrimRight ( @ScriptName, 4 ) & ' v' & FileGetVersion ( @ScriptFullPath ) & ' © wakillon 2010 - 2011' EndIf EndFunc ;==> _GetScriptVersion ( ) Func _About ( ) TrayItemSetState ( $_AboutItem , $TRAY_UNCHECKED ) Msgbox ( 262144+4160, "About : ", $_Version & @CRLF & @CRLF & "April 2011" & @CRLF & @CRLF & "Based on the noctis's Gamma Topic on AutoIt.de" & @CRLF & @CRLF & "wakillon." & @CRLF & " " ) EndFunc ;==> _About ( ) Func _GetTaskbarHeight ( ) $_OptOld = Opt ( "WinTitleMatchMode", 4 ) $_WinPos = WinGetPos ( "classname=Shell_TrayWnd" ) If @error Then Return -1 Opt ( "WinTitleMatchMode", $_OptOld ) Return $_WinPos[3] EndFunc ;==> _GetTaskbarHeight ( )Scripts and executables with full embeded files are available on GoogleCode, see link in my sig.Comments are welcome !All this time spent in front of the screen, remember to protect your eyes ! Edited October 8, 2012 by wakillon argumentum 1 AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
Foxhound Posted April 16, 2011 Share Posted April 16, 2011 Nice one Wakil, but question:Is there any way you could use the DeviceIoControl to set backlight brightness instead of Gamma? I've gotten started on it but I'm having trouble with creating the handle from CreateFile (first parameter).#include "winapi.au3" ;CreateFile ;$cHandle = DllCall("User32.dll","HANDLE","CreateFile","str", ;IOCTL_VIDEO_SET_DISPLAY_BRIGHTNESS $DISPLAY_BRIGHTNESS = DllStructCreate("uchar 0x00000003;uchar 50;uchar 10") DllCall("User32.dll","int","DeviceIoControl","HANDLE",$cHandle,"dword","IOCTL_VIDEO_SET_DISPLAY_BRIGHTNESS","ptr",DllStructGetPtr($DISPLAY_BRIGHTNESS),"int",500,"int","none","int",0,"int","none","ptr","none") ConsoleWrite(_WinAPI_GetLastError()&@CRLF)I'm not so good with DllCall yet Anyway nice script [quote]Quick YouTube To MP3 | Lyrics Finder | Internet Radio Player | GetWeather | TinyURLifier[/quote] Link to comment Share on other sites More sharing options...
JScript Posted April 16, 2011 Share Posted April 16, 2011 I like it! Very good indeed! Thanks for sharing... http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!) Somewhere Out ThereJames Ingram Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere! Link to comment Share on other sites More sharing options...
reb Posted April 17, 2011 Share Posted April 17, 2011 This is really a good script and works well on my win7 64 laptop. Thanks a lot for sharing with us. REB MEASURE TWICE - CUT ONCE Link to comment Share on other sites More sharing options...
wakillon Posted April 17, 2011 Author Share Posted April 17, 2011 (edited) Nice one Wakil, but question: Is there any way you could use the DeviceIoControl to set backlight brightness instead of Gamma? I've gotten started on it but I'm having trouble with creating the handle from CreateFile (first parameter). #include "winapi.au3" ;CreateFile ;$cHandle = DllCall("User32.dll","HANDLE","CreateFile","str", ;IOCTL_VIDEO_SET_DISPLAY_BRIGHTNESS $DISPLAY_BRIGHTNESS = DllStructCreate("uchar 0x00000003;uchar 50;uchar 10") DllCall("User32.dll","int","DeviceIoControl","HANDLE",$cHandle,"dword","IOCTL_VIDEO_SET_DISPLAY_BRIGHTNESS","ptr",DllStructGetPtr($DISPLAY_BRIGHTNESS),"int",500,"int","none","int",0,"int","none","ptr","none") ConsoleWrite(_WinAPI_GetLastError()&@CRLF) I'm not so good with DllCall yet Anyway nice script Thanks ! I have googling a long time for find an "universal" solution for set screen brightness. I have found autoit examples with device control, or by others way, but a probem was back often : compatibility with OS or driver. So i reduce my ambitions to gamma settings who is not a really "brightness" settings, but who can be used by all ! An example with device control found but not working for me : expandcollapse popupSay me if you managed to make it work ! Edited April 17, 2011 by wakillon AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options... wakillon Posted April 17, 2011 wakillon Active Members 3.3k 1 AutoIt Resistance Fighter Author Share Posted April 17, 2011 (edited) Sorry but i can't edit my AutoIt tags part it return error each time ! @Foxhound here is the script : #include <WinAPI.au3> $tagDISPLAY_BRIGHTNESS = "ubyte ucDisplayPolicy;ubyte ucACBrightness;ubyte ucDCBrightness" Global Const $IOCTL_VIDEO_QUERY_DISPLAY_BRIGHTNESS = Int(0x00230498) Global Const $IOCTL_VIDEO_SET_DISPLAY_BRIGHTNESS = Int(0x0023049C) Global Const $IOCTL_VIDEO_QUERY_SUPPORTED_BRIGHTNESS = Int(0x00230494) Global Const $hLCD = _WinAPI_CreateFile("\\.\LCD", 3, 2, 7) ConsoleWrite ( "_GetDisplayBrightness() : " & _GetDisplayBrightness() & @Crlf ) ConsoleWrite ( "_GetSupportedBrightness() : " & _GetSupportedBrightness() & @Crlf ) Func _GetDisplayBrightness() $DISPLAY_BRIGHTNESS = DllStructCreate($tagDISPLAY_BRIGHTNESS) DllStructSetData($DISPLAY_BRIGHTNESS, "ucDisplayPolicy", 0x1) DllStructSetData($DISPLAY_BRIGHTNESS, "ucACBrightness", 0x20) DllStructSetData($DISPLAY_BRIGHTNESS, "ucDCBrightness", 0x20) $ret = DllCall( _ "kernel32.dll", "int", _ "DeviceIoControl", _ "hwnd", $hLCD, _ "int", $IOCTL_VIDEO_QUERY_DISPLAY_BRIGHTNESS, _ "ptr", 0, _ "int", 0, _ "ptr", DllStructGetPtr($DISPLAY_BRIGHTNESS), _ "int", DllStructGetSize($DISPLAY_BRIGHTNESS), _ "int*", 0, _ "ptr", 0 ) Return SetError(@error, DllStructGetData($DISPLAY_BRIGHTNESS, "ucDCBrightness"), DllStructGetData($DISPLAY_BRIGHTNESS, "ucACBrightness")) EndFunc ;==> _GetDisplayBrightness ( ) Func _GetSupportedBrightness() $SURPPORTED_BRIGHTNESS = DllStructCreate("ubyte suported[256]") $ret = DllCall( _ "kernel32.dll", "int", _ "DeviceIoControl", _ "hwnd", $hLCD, _ "int", $IOCTL_VIDEO_QUERY_SUPPORTED_BRIGHTNESS, _ "ptr", 0, _ "int", 0, _ "ptr", DllStructGetPtr($SURPPORTED_BRIGHTNESS), _ "int", DllStructGetSize($SURPPORTED_BRIGHTNESS), _ "int*", 0, _ "ptr", 0 ) If $ret[0] = 0 Or $ret[7] = 0 Then Return SetError(@error, 0, 0) Dim $brightness[$ret[7]] For $i = 0 To UBound($brightness) - 1 $brightness[$i] = DllStructGetData($SURPPORTED_BRIGHTNESS, "suported", $i + 1) Next Return SetError(0, $ret[7], $brightness) EndFunc ;==> _GetSupportedBrightness ( ) Func _SetDisplayBrightness($ac = -1, $dc = -1) $DISPLAY_BRIGHTNESS = DllStructCreate($tagDISPLAY_BRIGHTNESS) Local $policy = 0 If $ac > -1 Then $policy += 1 DllStructSetData($DISPLAY_BRIGHTNESS, "ucACBrightness", $ac) EndIf If $dc > -1 Then $policy += 2 DllStructSetData($DISPLAY_BRIGHTNESS, "ucDCBrightness", $dc) EndIf DllStructSetData($DISPLAY_BRIGHTNESS, "ucDisplayPolicy", $policy) $ret = DllCall( _ "kernel32.dll", "int", _ "DeviceIoControl", _ "hwnd", $hLCD, _ "int", $IOCTL_VIDEO_SET_DISPLAY_BRIGHTNESS, _ "ptr", DllStructGetPtr($DISPLAY_BRIGHTNESS), _ "int", DllStructGetSize($DISPLAY_BRIGHTNESS), _ "ptr", 0, _ "int", 0, _ "int*", 0, _ "ptr", 0 ) Return SetError(@error, 0, $ret[0]) EndFunc ;==> _SetDisplayBrightness ( ) Edited April 17, 2011 by wakillon AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
wakillon Posted April 17, 2011 Author Share Posted April 17, 2011 I like it! Very good indeed!Thanks for sharing...This is really a good script and works well on my win7 64 laptop.Thanks a lot for sharing with us.REBI'm glad you like it !Thanks to both. AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
Yashied Posted April 17, 2011 Share Posted April 17, 2011 Look nice but there is one suggestion. It would be nice if you kept the proportions of RGB values ​​in the LUT. For examples:Here is the LUT before using TBC.After using TBC. My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
Foxhound Posted April 17, 2011 Share Posted April 17, 2011 (edited) It worked! But it only to decrease brightness, not increase it. Supported brightness for my laptop says 95, I put 92 for _SetDisplayBrightness() but it decreases the brightness all the way down for some reason Edited April 17, 2011 by Foxhound [quote]Quick YouTube To MP3 | Lyrics Finder | Internet Radio Player | GetWeather | TinyURLifier[/quote] Link to comment Share on other sites More sharing options...
wakillon Posted April 17, 2011 Author Share Posted April 17, 2011 (edited) Look nice but there is one suggestion. It would be nice if you kept the proportions of RGB values ​​in the LUT. For examples:Thanks ! Idea is interesting but i don't find any working function for get gamma settings and proportions !If you have any suggestion...Edit : I'm searching for GetDeviceGammaRamp but unsuccessfully. Edited April 17, 2011 by wakillon AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
wakillon Posted April 17, 2011 Author Share Posted April 17, 2011 It worked! But it only to decrease brightness, not increase it. Supported brightness for my laptop says 95, I put 92 for _SetDisplayBrightness() but it decreases the brightness all the way down for some reasonYou're lucky !On what OS are you ?I'm on xpsp3 and functions return 0 ! AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
Foxhound Posted April 17, 2011 Share Posted April 17, 2011 You're lucky !On what OS are you ?I'm on xpsp3 and functions return 0 ! Windows 7 Professional x86 [quote]Quick YouTube To MP3 | Lyrics Finder | Internet Radio Player | GetWeather | TinyURLifier[/quote] Link to comment Share on other sites More sharing options...
wakillon Posted April 17, 2011 Author Share Posted April 17, 2011 Windows 7 Professional x86 So, i was right when i talk about compatibility with OS ! Let me know If you find a multi OS solution ! AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
Yashied Posted April 17, 2011 Share Posted April 17, 2011 (edited) Windows 7 Professional x86 Works fine for me under this OS! Note, not all adapters support downloadable gamma ramps in hardware. I'm searching for GetDeviceGammaRamp but unsuccessfully. expandcollapse popup#Include <Array.au3> #Include <WinAPIEx.au3> Dim $Delta[256][3] $hForm = GUICreate('Lookup Table', 256, 256) $Pic = GUICtrlCreatePic('', 0, 0, 255, 255) $hDC = _WinAPI_GetDC(0) $tRamp = DllStructCreate('ushort[768]') $Ret = DllCall('gdi32.dll', 'int', 'GetDeviceGammaRamp', 'hwnd', $hDC, 'ptr', DllStructGetPtr($tRamp)) $hMemDC = _WinAPI_CreateCompatibleDC($hDC) $hBitmap = _WinAPI_CreateCompatibleBitmapEx($hDC, 256, 256, 0) $hSv1 = _WinAPI_SelectObject($hMemDC, $hBitmap) $hPen = _WinAPI_GetStockObject($DC_PEN) $hSv2 = _WinAPI_SelectObject($hMemDC, $hPen) _WinAPI_SetROP2($hMemDC, $R2_XORPEN) _WinAPI_ReleaseDC(0, $hDC) $Rgb = 0xFF0000 $Count = 1 For $i = 0 To 2 _WinAPI_SetDCPenColor($hMemDC, BitShift($Rgb, 8 * $i)) For $j = 0 To 255 $Delta[$j][$i] = Round(DllStructGetData($tRamp, 1, $Count) - $j / 255 * 65280) ; 65280 ??? If $j Then _WinAPI_LineTo($hMemDC, $j + 1, Round(255 * (1 - DllStructGetData($tRamp, 1, $Count) / 65280)) - 1) Else _WinAPI_MoveTo($hMemDC, 0, Round(255 * (1 - DllStructGetData($tRamp, 1, $Count) / 65280))) EndIf $Count += 1 Next Next _WinAPI_SelectObject($hMemDC, $hSv1) _WinAPI_SelectObject($hMemDC, $hSv2) _WinAPI_DeleteObject($hPen) _WinAPI_DeleteDC($hMemDC) GUICtrlSendMsg($Pic, 0x0172, 0, $hBitmap) GUISetState() _ArrayDisplay($Delta) Do Until GUIGetMsg() = -3 Edited April 17, 2011 by Yashied My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
wakillon Posted April 17, 2011 Author Share Posted April 17, 2011 @YashieldI have found this one, but doesn't give same results as yours...#include <Array.au3> $_GetGammaRamp = _GetGammaRamp() _ArrayDisplay ( $_GetGammaRamp ) Func _GetGammaRamp() Local $dc, $m_RampSaved,$ret,$avDisplay $dc = DLLCall("user32.dll","int","GetDC","hwnd",0) $m_RampSaved = DllStructCreate("short[" & (256*3) & "]") $ret = DLLCall("gdi32.dll","int","GetDeviceGammaRamp", "int",$dc[0],"ptr",DllStructGetPtr($m_RampSaved)) If Not $ret[0] Then MsgBox(4096,"WARNING", "WARNING: Cannot initialize DeviceGammaRamp.") $avDisplay = _GammaTo2d($m_RampSaved) $dc = 0 $m_RampSaved = 0 Return $avDisplay EndFunc ;==> _GetGammaRamp() Func _GammaTo2d($vm_RampSaved) Local $avDisplay[257][3] For $i = 0 to 256 $avDisplay[$i][0] = DllStructGetData($vm_RampSaved,1,$i) $avDisplay[$i][1] = DllStructGetData($vm_RampSaved,1,$i + 256) $avDisplay[$i][2] = DllStructGetData($vm_RampSaved,1,$i + 512) Next Return $avDisplay EndFunc ;==> _GammaTo2d() AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
Yashied Posted April 17, 2011 Share Posted April 17, 2011 (edited) Not all direct color video boards support loadable gamma ramps. What gives the following code? #Include <WinAPI.au3> $hDC = _WinAPI_GetDC(0) $tRamp = DllStructCreate('ushort[768]') $Ret = DllCall('gdi32.dll', 'int', 'GetDeviceGammaRamp', 'hwnd', $hDC, 'ptr', DllStructGetPtr($tRamp)) If (@error) Or (Not $Ret[0]) Then MsgBox(16, @error, _WinAPI_GetLastErrorMessage()) Else MsgBox(0, '', 'OK') EndIf _WinAPI_ReleaseDC(0, $hDC) Edit: Func _GammaTo2d($vm_RampSaved) Local $avDisplay[256][3] For $i = 0 To 255 $avDisplay[$i][0] = DllStructGetData($vm_RampSaved, 1, $i + 1) $avDisplay[$i][1] = DllStructGetData($vm_RampSaved, 1, $i + 1 + 256) $avDisplay[$i][2] = DllStructGetData($vm_RampSaved, 1, $i + 1 + 512) Next Return $avDisplay EndFunc ;==>_GammaTo2d Edited April 17, 2011 by Yashied My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
wakillon Posted April 17, 2011 Author Share Posted April 17, 2011 (edited) What gives the following code?It gives Ok Edit : And your function ( #post 14 ) give an array with only 256 in all the array. Edited April 17, 2011 by wakillon AutoIt 3.3.14.2 X86 - SciTE 3.6.0 - WIN 8.1 X64 - Other Example Scripts Link to comment Share on other sites More sharing options...
Yashied Posted April 17, 2011 Share Posted April 17, 2011 It gives OkThen structure was filled successfully. My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
Yashied Posted April 18, 2011 Share Posted April 18, 2011 Maximum value for each color is 65280 instead of 65535. Why? Maximum number of 8-bit number is 0xFF (255). Maximum number of gradations for each channel is 256. 255 * 256 = 65280 My UDFs: iKey | FTP Uploader | Battery Checker | Boot Manager | Font Viewer | UDF Keyword Manager | Run Dialog Replacement | USBProtect | 3D Axis | Calculator | Sleep | iSwitcher | TM | NetHelper | File Types Manager | Control Viewer | SynFolders | DLL Helper Animated Tray Icons UDF Library | Hotkeys UDF Library | Hotkeys Input Control UDF Library | Caret Shape UDF Library | Context Help UDF Library | Most Recently Used List UDF Library | Icons UDF Library | FTP UDF Library | Script Communications UDF Library | Color Chooser UDF Library | Color Picker Control UDF Library | IPHelper (Vista/7) UDF Library | WinAPI Extended UDF Library | WinAPIVhd UDF Library | Icon Chooser UDF Library | Copy UDF Library | Restart UDF Library | Event Log UDF Library | NotifyBox UDF Library | Pop-up Windows UDF Library | TVExplorer UDF Library | GuiHotKey UDF Library | GuiSysLink UDF Library | Package UDF Library | Skin UDF Library | AITray UDF Library | RDC UDF Library Appropriate path | Button text color | Gaussian random numbers | Header's styles (Vista/7) | ICON resource enumeration | Menu & INI | Tabbed string size | Tab's skin | Pop-up circular menu | Progress Bar without animation (Vista/7) | Registry export | Registry path jumping | Unique hardware ID | Windows alignment More... Link to comment Share on other sites More sharing options...
tonycst Posted October 11, 2013 Share Posted October 11, 2013 Its not working right. It does not brighten the screen or dim it out. It makes it brightening colors, not increasing/decreasing output power. As cool as it is, its not doing what it suppose to do. Still have to go to power options and adjust it from there. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now