Lakes Posted August 19, 2010 Share Posted August 19, 2010 (edited) expandcollapse popup#include <Constants.au3> #include <WinAPI.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include<StaticConstants.au3> Opt("GUIOnEventMode", 1) Global $hMain, $iW = 800, $iH = 800, $msg, $ColourSlider, $Mx, $My, $Col1, $Trans1 ; Create Slider GUI $hGUI1 = GUICreate("SliderGUI", 217, 126, 86, 793) $iSlider1 = GUICtrlCreateSlider(6, 74, 201, 21) $TransLabel = GUICtrlCreateLabel("Adjust Transparency", 66, 62, 101, 17) $Clickthru = GUICtrlCreateCheckbox("Clickthru", 10, 108, 13, 13) ;GUICtrlSetState(-1, 1) $Tog_label = GUICtrlCreateLabel("Toggle Clck Through", 30, 108, 104, 17) GUICtrlSetLimit($iSlider1, 254, 1) GUICtrlSetData ($iSlider1, 150) GUICtrlSetOnEvent($Clickthru, "SystemEvents") $ColourSlider = GUICtrlCreateSlider(4, 19, 201, 21) $ColourLabel = GUICtrlCreateLabel("Adjust Colour", 79, 4, 66, 17) GUICtrlSetLimit($ColourSlider, 254, 1) GUICtrlSetData ($ColourSlider, 150) GUISetOnEvent($GUI_EVENT_CLOSE, "SystemEvents") GUISetState(@SW_SHOW) ;Create Transparent GUI $hMain = GUICreate("", $iW ,$iH, -1, -1, BitOR($WS_POPUP,$WS_BORDER,$WS_SIZEBOX),$WS_EX_TOPMOST) GUISetBkColor(0x00) ;Set GUI Colour GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "SystemEvents") GUISetOnEvent($GUI_EVENT_SECONDARYDOWN, "SystemEvents") GUISetState(@SW_SHOW) WinSetTrans($hMain, "", 150) ; toggle Transparency While 1 sleep(50) $Trans = GUICtrlRead($iSlider1) $Col = GUICtrlRead($ColourSlider) $Colour = ($Col * 256 * 256) + ($Col * 256) + ($Col) If $Col <> $Col1 then ;Only update window if slider value changes GUISetBkColor($Colour) ;Set GUI Colour $Col = $Col1 Endif If $Trans <> $Trans1 Then WinSetTrans($hMain, "", $Trans) $Trans = $Trans1 Endif WEnd Func SystemEvents() Switch @GUI_CtrlId Case $GUI_EVENT_CLOSE Exit Case $Clickthru If BitAND(GUICtrlRead($Clickthru), $GUI_CHECKED) Then _WinAPI_SetWindowLong($hMain, $GWL_EXSTYLE, BitOR(_WinAPI_GetWindowLong($hMain, $GWL_EXSTYLE), $WS_EX_TRANSPARENT)) Else $NoTrans = BitNOT($WS_EX_TRANSPARENT) _WinAPI_SetWindowLong($hMain, $GWL_EXSTYLE, BitAND(_WinAPI_GetWindowLong($hMain, $GWL_EXSTYLE), $NoTrans)) EndIf Case $GUI_EVENT_PRIMARYDOWN Drag($hMain) Case $GUI_EVENT_PRIMARYUP ; Case $GUI_EVENT_SECONDARYDOWN ; EndSwitch EndFunc ;by Zedna Func Drag($h) ;~ dllcall("user32.dll","int","ReleaseCapture") DllCall("user32.dll","int","SendMessage","hWnd", $h,"int",$WM_NCLBUTTONDOWN,"int", $HTCAPTION,"int", 0) EndFunc Edited August 19, 2010 by Lakes 2015 - Still no flying cars, instead blankets with sleeves. Link to comment Share on other sites More sharing options...
MrCreatoR Posted August 19, 2010 Share Posted August 19, 2010 It's not a good idea to set stuff like that, use the events: expandcollapse popup#include <Constants.au3> #include <WinAPI.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <StaticConstants.au3> Opt("GUIOnEventMode", 1) Global $hMain, $iW = 800, $iH = 800, $msg, $ColourSlider, $Mx, $My ; Create Slider GUI $hGUI1 = GUICreate("SliderGUI", 217, 126, 86, 793) $iSlider1 = GUICtrlCreateSlider(6, 74, 201, 21) $TransLabel = GUICtrlCreateLabel("Adjust Transparency", 66, 62, 101, 17) $Clickthru = GUICtrlCreateCheckbox("Clickthru", 10, 108, 13, 13) $Tog_label = GUICtrlCreateLabel("Toggle Clck Through", 30, 108, 104, 17) GUICtrlSetLimit($iSlider1, 254, 1) GUICtrlSetData($iSlider1, 150) GUICtrlSetOnEvent($iSlider1, "SystemEvents") GUICtrlSetOnEvent($Clickthru, "SystemEvents") $ColourSlider = GUICtrlCreateSlider(4, 19, 201, 21) $ColourLabel = GUICtrlCreateLabel("Adjust Colour", 79, 4, 66, 17) GUICtrlSetLimit($ColourSlider, 254, 1) GUICtrlSetData($ColourSlider, 150) GUISetOnEvent($GUI_EVENT_CLOSE, "SystemEvents") GUICtrlSetOnEvent($ColourSlider, "SystemEvents") GUISetState(@SW_SHOW) ;Create Transparent GUI $hMain = GUICreate("", $iW, $iH, -1, -1, BitOR($WS_POPUP, $WS_BORDER, $WS_SIZEBOX), BitOR($WS_EX_TOPMOST, $WS_EX_CONTROLPARENT)) GUISetBkColor(0x00) ;Set GUI Colour GUISetState(@SW_SHOW) WinSetTrans($hMain, "", 150) While 1 Sleep(10) WEnd Func SystemEvents() Switch @GUI_CtrlId Case $GUI_EVENT_CLOSE Exit Case $Clickthru If BitAND(GUICtrlRead($Clickthru), $GUI_CHECKED) Then _WinAPI_SetWindowLong($hMain, $GWL_EXSTYLE, BitOR(_WinAPI_GetWindowLong($hMain, $GWL_EXSTYLE), $WS_EX_TRANSPARENT)) Else $NoTrans = BitNOT($WS_EX_TRANSPARENT) _WinAPI_SetWindowLong($hMain, $GWL_EXSTYLE, BitAND(_WinAPI_GetWindowLong($hMain, $GWL_EXSTYLE), $NoTrans)) EndIf Case $iSlider1 $Trans = GUICtrlRead($iSlider1) WinSetTrans($hMain, "", $Trans) Case $ColourSlider $Col = GUICtrlRead($ColourSlider) $Colour = ($Col * 256 * 256) + ($Col * 256) + ($Col) GUISetBkColor($Colour) ;Set GUI Colour EndSwitch EndFunc Spoiler Using OS: Win 7 Professional, Using AutoIt Ver(s): 3.3.6.1 / 3.3.8.1 AutoIt Russian Community My Work... Spoiler Projects: ATT - Application Translate Tool {new}| BlockIt - Block files & folders {new}| SIP - Selected Image Preview {new}| SISCABMAN - SciTE Abbreviations Manager {new}| AutoIt Path Switcher | AutoIt Menu for Opera! | YouTube Download Center! | Desktop Icons Restorator | Math Tasks | KeyBoard & Mouse Cleaner | CaptureIt - Capture Images Utility | CheckFileSize ProgramUDFs: OnAutoItErrorRegister - Handle AutoIt critical errors {new}| AutoIt Syntax Highlight {new}| Opera Library! | Winamp Library | GetFolderToMenu | Custom_InputBox()! | _FileRun UDF | _CheckInput() UDF | _GUIInputSetOnlyNumbers() UDF | _FileGetValidName() UDF | _GUICtrlCreateRadioCBox UDF | _GuiCreateGrid() | _PathSplitByRegExp() | _GUICtrlListView_MoveItems - UDF | GUICtrlSetOnHover_UDF! | _ControlTab UDF! | _MouseSetOnEvent() UDF! | _ProcessListEx - UDF | GUICtrl_SetResizing - UDF! | Mod. for _IniString UDFs | _StringStripChars UDF | _ColorIsDarkShade UDF | _ColorConvertValue UDF | _GUICtrlTab_CoverBackground | CUI_App_UDF | _IncludeScripts UDF | _AutoIt3ExecuteCode | _DragList UDF | Mod. for _ListView_Progress | _ListView_SysLink | _GenerateRandomNumbers | _BlockInputEx | _IsPressedEx | OnAutoItExit Handler | _GUICtrlCreateTFLabel UDF | WinControlSetEvent UDF | Mod. for _DirGetSizeEx UDF Examples: ScreenSaver Demo - Matrix included | Gui Drag Without pause the script | _WinAttach()! | Turn Off/On Monitor | ComboBox Handler Example | Mod. for "Thinking Box" | Cool "About" Box | TasksBar Imitation Demo Like the Projects/UDFs/Examples? Please rate the topic (up-right corner of the post header: Rating ) * === My topics === * ================================================== ================================================== AutoIt is simple, subtle, elegant. © AutoIt Team Link to comment Share on other sites More sharing options...
Lakes Posted August 19, 2010 Author Share Posted August 19, 2010 (edited) Lost the window sizing and the window only updates after you release the mouse button. EDIT: Updated script in first post. Edited August 19, 2010 by Lakes 2015 - Still no flying cars, instead blankets with sleeves. 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