Moderators Melba23 Posted August 4, 2013 Moderators Share Posted August 4, 2013 Wombat.Use the #region/#endregion directives to create foldable zones in your script. They are nestable - I have a 6000+ line script which is 17 lines folded and with no function more than 3 clicks away. M23 Wombat 1 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
FireFox Posted August 4, 2013 Share Posted August 4, 2013 (edited) please, what works ? PhoenixXL's script. You said it didn't work for you on XP. My bad, I missunderstood posts. Edited August 4, 2013 by FireFox Link to comment Share on other sites More sharing options...
Wombat Posted August 4, 2013 Author Share Posted August 4, 2013 Wombat. Use the #region/#endregion directives to create foldable zones in your script. They are nestable - I have a 6000+ line script which is 17 lines folded and with no function more than 3 clicks away. M23 Thank you Melba23 Just look at us.Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner The internet is our one and only hope at a truly free world, do not let them take it from us... Link to comment Share on other sites More sharing options...
PhoenixXL Posted August 5, 2013 Share Posted August 5, 2013 (edited) please, what works ? WS_EX_TRANSPARENT style would make the window pass the mouse-clicks to the underlying window. The invisible window that holds the controls needs to be transparent otherwise clicks would get captured by the invisible window and the gaps on the layered window won't activate the underlying window. If you still don't get my point, try the following code and click on the parts of the layered window that should activate the underlying window. expandcollapse popup#include <GDIPlus.au3> #include <WindowsConstants.au3> #include <GuiConstantsEx.au3> #include <StaticConstants.au3> #include <Constants.au3> #include <Array.au3> Global Const $AC_SRC_ALPHA = 1 Global $iWidth, $iHeight, $hRegion Global $___hNew_WndProc, $___pNew_WndProc, $___pOld_WndProc _GDIPlus_Startup() $s_Bitmap = @ScriptDir & "\GUI.png" ;http://img823.imageshack.us/img823/8938/ciik.png - link given by the OP at http://www.autoitscript.com/forum/topic/153261-who-wants-to-help-me-learn-enhanced-gui-building/#entry1102795 $hLayeredGUI = _GUICreate_Alpha("LayeredWin | Phoenix XL", $s_Bitmap, $iWidth, $iHeight) GUISetState() ;show the main gui ;when the background color and the transcolor are the same of a layered GUI we recieve transparent background ;this would create an invisible window $hControls_GUI = GUICreate("ControlGUI", $iWidth, $iHeight, 0, 0, $WS_POPUP, BitOR($WS_EX_MDICHILD, $WS_EX_LAYERED), $hLayeredGUI) GUISetBkColor(0xABCDEF) _WinAPI_SetLayeredWindowAttributes($hControls_GUI, 0xABCDEF, 230) ;set transparency to 230 ;the close button you can use icon also $iCloseButton = GUICtrlCreateLabel("X", 26, 30, 10, 10) GUICtrlSetCursor(-1, 0) GUICtrlSetColor(-1, 0xFFFFFF) ;now lets create the so required controls to sync the user interaction $iProgressBar = GUICtrlCreateProgress(80, 50, 360, 30) GUICtrlSetData(-1, 20) ;set the initial position of the progress to 20 $iText = GUICtrlCreateLabel("You will get all the status updates and the information here...." & @CRLF & "Stay Tuned..", 80, 90, 279, 205) GUISetState() ;show the controls window Local $iMsg, $aInfo, $f_ClkThrough = False Do $iMsg = GUIGetMsg(1) ;use advanced method for there are multiple GUIs Switch $iMsg[1] Case $hControls_GUI ;msg is received from controls gui Switch $iMsg[0] Case $iCloseButton ;close btn is clicked ExitLoop EndSwitch EndSwitch Until $iMsg[0] = $GUI_EVENT_CLOSE _GDIPlus_Shutdown() Exit Func _WinSetClickThrough($hWin, $iCLickThrough = True) Local $iExStyle = GUIGetStyle($hWin) $iExStyle = $iExStyle[1] If $iCLickThrough Then $iExStyle = BitOR($iExStyle, $WS_EX_TRANSPARENT) Else $iExStyle = BitXOR($iExStyle, $WS_EX_TRANSPARENT) EndIf Return GUISetStyle(Default, $iExStyle) EndFunc ;==>_WinSetClickThrough ;I have not created the following functions.. Func _GUICreate_Alpha($sTitle, $sPath, ByRef $iWidth, ByRef $iHeight, $iX = -1, $iY = -1, $iOpacity = 255) Local $hGUI, $hImage $hImage = _GDIPlus_ImageLoadFromFile($sPath) $iWidth = _GDIPlus_ImageGetWidth($hImage) $iHeight = _GDIPlus_ImageGetHeight($hImage) $hGUI = GUICreate($sTitle, $iWidth, $iHeight, $iX, $iY, $WS_POPUP, $WS_EX_LAYERED) SetBitmap($hGUI, $hImage, $iOpacity) _GDIPlus_ImageDispose($hImage) Return $hGUI EndFunc ;==>_GUICreate_Alpha Func SetBitmap($hGUI, $hImage, $iOpacity) Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend $hScrDC = _WinAPI_GetDC(0) $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC) $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap) $tSize = DllStructCreate($tagSIZE) $pSize = DllStructGetPtr($tSize) DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth($hImage)) DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage)) $tSource = DllStructCreate($tagPOINT) $pSource = DllStructGetPtr($tSource) $tBlend = DllStructCreate($tagBLENDFUNCTION) $pBlend = DllStructGetPtr($tBlend) DllStructSetData($tBlend, "Alpha", $iOpacity) DllStructSetData($tBlend, "Format", $AC_SRC_ALPHA) _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA) _WinAPI_ReleaseDC(0, $hScrDC) _WinAPI_SelectObject($hMemDC, $hOld) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteDC($hMemDC) EndFunc ;==>SetBitmap The original script would allow click-through Edited August 7, 2013 by PhoenixXL My code: PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners. MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression. Link to comment Share on other sites More sharing options...
Edano Posted August 5, 2013 Share Posted August 5, 2013 yes, i cannot click thru. i can see the underlying windows, but cannot activate them. is that a winxp thing (xp pro sp3) ? [color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font] Link to comment Share on other sites More sharing options...
Wombat Posted August 5, 2013 Author Share Posted August 5, 2013 expandcollapse popup#region ; Includes #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GDIPlus.au3> #include <WindowsConstants.au3> #include <GuiConstantsEx.au3> #include <StaticConstants.au3> #include <Constants.au3> #include <Array.au3> #endregion ; Includes Opt("GUIOnEventMode", 0) #region;;;;;;GUI Section;;;;;;; Global $sFile = "C:\Users\Wombat\Pictures\example2.png" Global Const $AC_SRC_ALPHA = 1 Global $iWidth, $iHeight, $hRegion Global $___hNew_WndProc, $___pNew_WndProc, $___pOld_WndProc _GDIPlus_Startup() $s_Bitmap = $sFile ;http://img823.imageshack.us/img823/8938/ciik.png - link given by the OP at http://www.autoitscript.com/forum/topic/153261-who-wants-to-help-me-learn-enhanced-gui-building/#entry1102795 $hLayeredGUI = _GUICreate_Alpha("End-Hancer", $s_Bitmap, $iWidth, $iHeight) GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST") GUISetState() ;show the main gui ;when the background color and the transcolor are the same of a layered GUI we recieve transparent background ;this would create an invisible window $hControls_GUI = GUICreate("ControlGUI", $iWidth, $iHeight, 0, 0, $WS_POPUP, BitOR($WS_EX_MDICHILD, $WS_EX_LAYERED), $hLayeredGUI) GUISetBkColor(0xABCDEF) _WinAPI_SetLayeredWindowAttributes($hControls_GUI, 0xABCDEF, 230) ;set transparency to 230 ;the close button you can use icon also $iCloseButton = GUICtrlCreateLabel("X", 175, 260, 10, 10) GUICtrlSetCursor(-1, 0) GUICtrlSetColor(-1, 0xFFFFFF) GUISetOnEvent(-1, "CloseGUI") ;now lets create the so required controls to sync the user interaction $iProgressBar = GUICtrlCreateProgress(200, 450, 360, 15) GUICtrlSetState(-1, $GUI_HIDE) GUICtrlSetData(-1, 100) ;set the initial position of the progress to 20 #Region ; Menu $iCheckUpdates = GUICtrlCreateLabel("Check For Updates", 250, 350, 140, 18) GUICtrlSetFont(-1, 10, 1000, 0, "MS Sans Serif") GUICtrlSetCursor(-1, 0) GUICtrlSetColor(-1, 0xFFFFFF) GUISetOnEvent(-1, "UpdateVersion") $iGraphicsConfig = GUICtrlCreateLabel("Graphics Config", 425, 350, 115, 18) GUICtrlSetFont(-1, 10, 1000, 0, "MS Sans Serif") GUICtrlSetCursor(-1, 0) GUICtrlSetColor(-1, 0xFFFFFF) GUISetOnEvent(-1, "Opti_Options") $iMLConfig = GUICtrlCreateLabel("Launcher Config", 575, 350, 160, 18) GUICtrlSetFont(-1, 10, 1000, 0, "MS Sans Serif") GUICtrlSetCursor(-1, 0) GUICtrlSetColor(-1, 0xFFFFFF) GUISetOnEvent(-1, "LauncherOptions") #endregion ; Menu ;;;;;;;;; GUISetState() ;show the controls window ;;;;;;;;; Local $iMsg, $aInfo, $f_ClkThrough = False Do $iMsg = GUIGetMsg(1) ;use advanced method for there are multiple GUIs Switch $iMsg[1] Case $hControls_GUI ;msg is received from controls gui Switch $iMsg[0] Case $iCloseButton ;close btn is clicked ExitLoop EndSwitch EndSwitch $aInfo = GUIGetCursorInfo($hControls_GUI) If @error Then ContinueLoop ;enable clickthrough for the invisible control gui If $aInfo[4] = 0 And $f_ClkThrough = False Then _WinSetClickThrough($hControls_GUI) $f_ClkThrough = True ElseIf $aInfo[4] And $f_ClkThrough Then _WinSetClickThrough($hControls_GUI, False) $f_ClkThrough = False EndIf Until $iMsg[0] = $GUI_EVENT_CLOSE #region ;Version check and update Func UpdateVersion() GUICtrlSetFont($iCheckUpdates, 10, 1000, 6, "MS Sans Serif") EndFunc ;==>UpdateVersion #endregion ;Version check and update #region ;About and help Func AboutInfo() EndFunc ;==>AboutInfo Func HelpInfo() EndFunc ;==>HelpInfo #endregion ;About and help #region ;Options section Func LauncherOptions() EndFunc Func Opti_Options() EndFunc #endregion Func CloseGUI() GUIDelete("End-Hancer") Exit EndFunc Func WM_NCHITTEST($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam Return $HTCAPTION EndFunc ;==>WM_NCHITTEST Func _WinSetClickThrough($hWin, $iCLickThrough = True) Local $iExStyle = GUIGetStyle($hWin) $iExStyle = $iExStyle[1] If $iCLickThrough Then $iExStyle = BitOR($iExStyle, $WS_EX_TRANSPARENT) Else $iExStyle = BitXOR($iExStyle, $WS_EX_TRANSPARENT) EndIf Return GUISetStyle(Default, $iExStyle) EndFunc ;==>_WinSetClickThrough ;I have not created the following functions.. Func _GUICreate_Alpha($sTitle, $sPath, ByRef $iWidth, ByRef $iHeight, $iX = -1, $iY = -1, $iOpacity = 255) Local $hGUI, $hImage, $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend $hImage = _GDIPlus_ImageLoadFromFile($sPath) $iWidth = _GDIPlus_ImageGetWidth($hImage) $iHeight = _GDIPlus_ImageGetHeight($hImage) $hGUI = GUICreate($sTitle, $iWidth, $iHeight, $iX, $iY, $WS_POPUP, $WS_EX_LAYERED) SetBitmap($hGUI, $hImage, $iOpacity) _GDIPlus_ImageDispose($hImage) Return $hGUI EndFunc ;==>_GUICreate_Alpha Func SetBitmap($hGUI, $hImage, $iOpacity) Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend $hScrDC = _WinAPI_GetDC(0) $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC) $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap) $tSize = DllStructCreate($tagSIZE) $pSize = DllStructGetPtr($tSize) DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth($hImage)) DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage)) $tSource = DllStructCreate($tagPOINT) $pSource = DllStructGetPtr($tSource) $tBlend = DllStructCreate($tagBLENDFUNCTION) $pBlend = DllStructGetPtr($tBlend) DllStructSetData($tBlend, "Alpha", $iOpacity) DllStructSetData($tBlend, "Format", $AC_SRC_ALPHA) _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA) _WinAPI_ReleaseDC(0, $hScrDC) _WinAPI_SelectObject($hMemDC, $hOld) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteDC($hMemDC) EndFunc ;==>SetBitmap #endregion;;;;;;GUI Section;;;;;;; Why do the SetOnEvent's for the labels not work??? Just look at us.Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner The internet is our one and only hope at a truly free world, do not let them take it from us... Link to comment Share on other sites More sharing options...
Edano Posted August 5, 2013 Share Posted August 5, 2013 Opt("GUIOnEventMode", 1) [color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font] Link to comment Share on other sites More sharing options...
Edano Posted August 5, 2013 Share Posted August 5, 2013 (edited) and: GUICtrlSetOnEvent(-1, "CloseGUI") . and you cannot use guigetmsg() in on-event-mode edit: for long scripts, on-event-mode is preferable. edit: you make a well structured script. Edited August 5, 2013 by Edano [color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font] Link to comment Share on other sites More sharing options...
Wombat Posted August 5, 2013 Author Share Posted August 5, 2013 Opt("GUIOnEventMode", 1) When I set this to 1 the close function doesn't work, when i set it to 0 only the close function and the dragging function worksI'm super confusedAND:and:GUICtrlSetOnEvent(-1, "CloseGUI").and you cannot use guigetmsg() in on-event-modeexplain pleaseedit: for long scripts, on-event-mode is preferable.I'm using no-event-modeedit: you make a well structured script. A lot of it was done by PheonixXL, I just try to keep the structure tight and easy to reference Just look at us.Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner The internet is our one and only hope at a truly free world, do not let them take it from us... Link to comment Share on other sites More sharing options...
Edano Posted August 5, 2013 Share Posted August 5, 2013 (edited) 0. http://www.autoitscript.com/autoit3/docs/ 1. http://www.autoitscript.com/autoit3/docs/guiref/GUIRef.htm 2. http://www.autoitscript.com/autoit3/docs/guiref/GUIRef_MessageLoopMode.htm 3. http://www.autoitscript.com/autoit3/docs/guiref/GUIRef_OnEventMode.htm . you have to decide to either use on-event-mode or not. Edited August 5, 2013 by Edano Wombat 1 [color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font] Link to comment Share on other sites More sharing options...
Wombat Posted August 5, 2013 Author Share Posted August 5, 2013 (edited) 0. http://www.autoitscript.com/autoit3/docs/ 1. http://www.autoitscript.com/autoit3/docs/guiref/GUIRef.htm 2. http://www.autoitscript.com/autoit3/docs/guiref/GUIRef_MessageLoopMode.htm 3. http://www.autoitscript.com/autoit3/docs/guiref/GUIRef_OnEventMode.htm . you have to decide to either use on-event-mode or not. So the script given by PheonixXL is coded for MessageLoopMode huh..... Ok, I'll see if I can convert it to OnEventMode then, though I haven't a clue how to. Lets see what I can come up with Thank you btw Edited August 5, 2013 by Wombat Just look at us.Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner The internet is our one and only hope at a truly free world, do not let them take it from us... Link to comment Share on other sites More sharing options...
Edano Posted August 5, 2013 Share Posted August 5, 2013 it's not really difficult, once you understand the tutorial, it's quite clear. but it's basic and important to know. Wombat 1 [color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font] Link to comment Share on other sites More sharing options...
Wombat Posted August 5, 2013 Author Share Posted August 5, 2013 expandcollapse popup#region ; Includes #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GDIPlus.au3> #include <WindowsConstants.au3> #include <GuiConstantsEx.au3> #include <StaticConstants.au3> #include <Constants.au3> #include <Array.au3> #endregion ; Includes Opt("GUIOnEventMode", 1) #region;;;;;;GUI Section;;;;;;; Global $sFile = "C:\prog_res\Lab\test_res\ciik.png" Global Const $AC_SRC_ALPHA = 1 Global $iWidth, $iHeight, $hRegion Global $___hNew_WndProc, $___pNew_WndProc, $___pOld_WndProc _GDIPlus_Startup() $s_Bitmap = $sFile ;http://img823.imageshack.us/img823/8938/ciik.png - link given by the OP at http://www.autoitscript.com/forum/topic/153261-who-wants-to-help-me-learn-enhanced-gui-building/#entry1102795 $hLayeredGUI = _GUICreate_Alpha("End-Hancer", $s_Bitmap, $iWidth, $iHeight) GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST") GUISetState() ;show the main gui ;when the background color and the transcolor are the same of a layered GUI we recieve transparent background ;this would create an invisible window $hControls_GUI = GUICreate("ControlGUI", $iWidth, $iHeight, 0, 0, $WS_POPUP, BitOR($WS_EX_MDICHILD, $WS_EX_LAYERED), $hLayeredGUI) GUISetBkColor(0xABCDEF) _WinAPI_SetLayeredWindowAttributes($hControls_GUI, 0xABCDEF, 230) ;set transparency to 230 ;the close button you can use icon also $iCloseButton = GUICtrlCreateLabel("X", 175, 260, 10, 10) GUICtrlSetCursor(-1, 0) GUICtrlSetColor(-1, 0xFFFFFF) GUISetOnEvent(-1, "CloseGUI") ;now lets create the so required controls to sync the user interaction $iProgressBar = GUICtrlCreateProgress(200, 450, 360, 15) GUICtrlSetState(-1, $GUI_HIDE) GUICtrlSetData(-1, 100) ;set the initial position of the progress to 20 #Region ; Menu $iCheckUpdates = GUICtrlCreateLabel("Check For Updates", 250, 350, 140, 18) GUICtrlSetFont(-1, 10, 1000, 0, "MS Sans Serif") GUICtrlSetCursor(-1, 0) GUICtrlSetColor(-1, 0xFFFFFF) GUISetOnEvent(-1, "UpdateVersion") $iGraphicsConfig = GUICtrlCreateLabel("Graphics Config", 425, 350, 115, 18) GUICtrlSetFont(-1, 10, 1000, 0, "MS Sans Serif") GUICtrlSetCursor(-1, 0) GUICtrlSetColor(-1, 0xFFFFFF) GUISetOnEvent(-1, "Opti_Options") $iMLConfig = GUICtrlCreateLabel("Launcher Config", 575, 350, 160, 18) GUICtrlSetFont(-1, 10, 1000, 0, "MS Sans Serif") GUICtrlSetCursor(-1, 0) GUICtrlSetColor(-1, 0xFFFFFF) GUISetOnEvent(-1, "LauncherOptions") #endregion ; Menu ;;;;;;;;; GUISetState() ;show the controls window ;;;;;;;;; Local $iMsg, $aInfo, $f_ClkThrough = False While 1 $aInfo = GUIGetCursorInfo($hControls_GUI) If @error Then ContinueLoop ;enable clickthrough for the invisible control gui If $aInfo[4] = 0 And $f_ClkThrough = False Then _WinSetClickThrough($hControls_GUI) $f_ClkThrough = True ElseIf $aInfo[4] And $f_ClkThrough Then _WinSetClickThrough($hControls_GUI, False) $f_ClkThrough = False EndIf WEnd #region ;Version check and update Func UpdateVersion() GUICtrlSetFont($iCheckUpdates, 10, 1000, 6, "MS Sans Serif") EndFunc ;==>UpdateVersion #endregion ;Version check and update #region ;About and help Func AboutInfo() EndFunc ;==>AboutInfo Func HelpInfo() EndFunc ;==>HelpInfo #endregion ;About and help #region ;Options section Func LauncherOptions() EndFunc Func Opti_Options() EndFunc #endregion Func CloseGUI() GUIDelete("End-Hancer") Exit EndFunc Func WM_NCHITTEST($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam Return $HTCAPTION EndFunc ;==>WM_NCHITTEST Func _WinSetClickThrough($hWin, $iCLickThrough = True) Local $iExStyle = GUIGetStyle($hWin) $iExStyle = $iExStyle[1] If $iCLickThrough Then $iExStyle = BitOR($iExStyle, $WS_EX_TRANSPARENT) Else $iExStyle = BitXOR($iExStyle, $WS_EX_TRANSPARENT) EndIf Return GUISetStyle(Default, $iExStyle) EndFunc ;==>_WinSetClickThrough ;I have not created the following functions.. Func _GUICreate_Alpha($sTitle, $sPath, ByRef $iWidth, ByRef $iHeight, $iX = -1, $iY = -1, $iOpacity = 255) Local $hGUI, $hImage, $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend $hImage = _GDIPlus_ImageLoadFromFile($sPath) $iWidth = _GDIPlus_ImageGetWidth($hImage) $iHeight = _GDIPlus_ImageGetHeight($hImage) $hGUI = GUICreate($sTitle, $iWidth, $iHeight, $iX, $iY, $WS_POPUP, $WS_EX_LAYERED) SetBitmap($hGUI, $hImage, $iOpacity) _GDIPlus_ImageDispose($hImage) Return $hGUI EndFunc ;==>_GUICreate_Alpha Func SetBitmap($hGUI, $hImage, $iOpacity) Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend $hScrDC = _WinAPI_GetDC(0) $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC) $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap) $tSize = DllStructCreate($tagSIZE) $pSize = DllStructGetPtr($tSize) DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth($hImage)) DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage)) $tSource = DllStructCreate($tagPOINT) $pSource = DllStructGetPtr($tSource) $tBlend = DllStructCreate($tagBLENDFUNCTION) $pBlend = DllStructGetPtr($tBlend) DllStructSetData($tBlend, "Alpha", $iOpacity) DllStructSetData($tBlend, "Format", $AC_SRC_ALPHA) _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA) _WinAPI_ReleaseDC(0, $hScrDC) _WinAPI_SelectObject($hMemDC, $hOld) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteDC($hMemDC) EndFunc ;==>SetBitmap #endregion;;;;;;GUI Section;;;;;;; I cannot figure out why this doesn't work. I have the Opt("GUIOnEventMode", 1) set and I have the loop mode converted to a While 1 Func What am I missing? Just look at us.Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner The internet is our one and only hope at a truly free world, do not let them take it from us... Link to comment Share on other sites More sharing options...
Edano Posted August 5, 2013 Share Posted August 5, 2013 and: GUICtrlSetOnEvent(-1, "CloseGUI") . . instead of GUISetOnEvent, you need GUICtrlSetOnEvent for all the controls. [color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font] Link to comment Share on other sites More sharing options...
Wombat Posted August 5, 2013 Author Share Posted August 5, 2013 . instead of GUISetOnEvent, you need GUICtrlSetOnEvent for all the controls. Pretend we didn't see that.... Just look at us.Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner The internet is our one and only hope at a truly free world, do not let them take it from us... Link to comment Share on other sites More sharing options...
Edano Posted August 6, 2013 Share Posted August 6, 2013 you want me to delete it ? [color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font] Link to comment Share on other sites More sharing options...
Wombat Posted August 6, 2013 Author Share Posted August 6, 2013 I have a quick question... When I add a Group control to this gui, clicking and dragging the group control drags the controls but not the entire gui.... How can I set it to drag the entire GUI? I've added $GUI_WS_EX_PARENTDRAG to both GUICreate's... all it does is add scrollbars at the bottom of the gui's without solving my issue Just look at us.Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner The internet is our one and only hope at a truly free world, do not let them take it from us... Link to comment Share on other sites More sharing options...
Edano Posted August 6, 2013 Share Posted August 6, 2013 (edited) $GUI_WS_EX_PARENTDRAG is an EXtended style. you must apply it to the ex style param of the gui and the ex style param of the control(s). . expandcollapse popup;http://www.autoitscript.com/forum/topic/153261-who-wants-to-help-me-learn-enhanced-gui-building/page-2#entry1104018 ;Post #19 ;D:\DOKUME~1\ADMINI~1\LOKALE~1\Temp\SLICER\Avatar\photo-thumb-79839.png ;by Wombat ;Script grabbed by SLICER by Edano here: http://www.autoitscript.com/forum/topic/152402-slicer-autoit-forum-script-grabber/?p=1093575 $GUI=GUICreate("SLICER by Edano",130,17,1,0,0x80800000,0x100000);$WS_POPUP+$WS_BORDER;$GUI_WS_EX_PARENTDRAG GUISetIcon(@SystemDir&"\shell32.dll",-45) GUISetFont(8,1000,0,"Arial") GUISetBkColor(0) GUICtrlSetState(GUICtrlCreateLabel("",0,0,130,19),128) GUICtrlSetBkColor(-1,0xFFFFFF) ; by Edano GUICtrlSetFont(GUICtrlCreateLabel(" SLICER",0,1,98,14,512,0x100000),9);,800,0,"Tahoma");ex_parentdrag GUICtrlSetBkColor(-1,0xFF0000) GUICtrlSetColor(-1,0xFFFFFF) GUICtrlCreateIcon(@SystemDir&"\shell32.dll",-45,2,3,10,10) GUICtrlSetCursor(GUICtrlCreateLabel("+",98,1,10,14,512,0x100000),0);ex_parentdrag GUICtrlSetTip(-1,"Always on top") GUICtrlSetBkColor(-1,0xFF0000) GUICtrlSetColor(-1,0xFFFFFF) ;GUICtrlSetOnEvent(-1,"_Top") GUICtrlSetFont(-1,11) GUICtrlSetCursor(GUICtrlCreateLabel(Chr(150),108,1,10,14,513,0x100000),0);ex_parentdrag ;GUICtrlSetOnEvent(-1,"_Minimize"); "–" GUICtrlSetBkColor(-1,0xFF0000) GUICtrlSetColor(-1,0xFFFFFF) ;GUICtrlSetTip(-1,"Minimize") GUICtrlSetFont(-1,10) GUICtrlSetCursor(GUICtrlCreateLabel("x",118,1,12,14,513,0x100000),0);ex_parentdrag GUICtrlSetBkColor(-1,0xFF0000) ;GUICtrlSetOnEvent(-1,"_Exit") GUICtrlSetColor(-1,0xFFFFFF) GUICtrlSetTip(-1,"Exit") GUICtrlSetFont(-1,9) GUICtrlSetBkColor(GUICtrlCreateLabel("",0,16,130,2,-1,0x100000),0xF20000);ex_parentdrag GUISetState() while sleep(20) wend Edited August 6, 2013 by Edano [color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font] Link to comment Share on other sites More sharing options...
Edano Posted August 6, 2013 Share Posted August 6, 2013 (edited) another way to make the entire gui movable for every control is: . expandcollapse popup;http://www.autoitscript.com/forum/topic/153261-who-wants-to-help-me-learn-enhanced-gui-building/page-2#entry1104018 ;Post #19 ;D:\DOKUME~1\ADMINI~1\LOKALE~1\Temp\SLICER\Avatar\photo-thumb-79839.png ;by Wombat ;Script grabbed by SLICER by Edano here: http://www.autoitscript.com/forum/topic/152402-slicer-autoit-forum-script-grabber/?p=1093575 Opt("GUIOnEventMode",1) $GUI=GUICreate("SLICER by Edano",130,17,1,0,0x80800000);,0x100000);$WS_POPUP+$WS_BORDER;$GUI_WS_EX_PARENTDRAG GUISetIcon(@SystemDir&"\shell32.dll",-45) GUISetFont(8,1000,0,"Arial") GUISetBkColor(0) GUICtrlSetState(GUICtrlCreateLabel("",0,0,130,19),128) GUICtrlSetBkColor(-1,0xFFFFFF) ; by Edano GUICtrlSetFont(GUICtrlCreateLabel(" SLICER",0,1,98,14,512),9);,0x100000),9);,800,0,"Tahoma");ex_parentdrag GUICtrlSetBkColor(-1,0xFF0000) GUICtrlSetColor(-1,0xFFFFFF) GUICtrlCreateIcon(@SystemDir&"\shell32.dll",-45,2,3,10,10) GUICtrlSetCursor(GUICtrlCreateLabel("+",98,1,10,14,512),0);,0x100000),0);ex_parentdrag GUICtrlSetTip(-1,"Always on top") GUICtrlSetBkColor(-1,0xFF0000) GUICtrlSetColor(-1,0xFFFFFF) ;GUICtrlSetOnEvent(-1,"_Top") GUICtrlSetFont(-1,11) GUICtrlSetCursor(GUICtrlCreateLabel(Chr(150),108,1,10,14,513),0);,0x100000),0);ex_parentdrag ;GUICtrlSetOnEvent(-1,"_Minimize"); "–" GUICtrlSetBkColor(-1,0xFF0000) GUICtrlSetColor(-1,0xFFFFFF) ;GUICtrlSetTip(-1,"Minimize") GUICtrlSetFont(-1,10) GUICtrlSetCursor(GUICtrlCreateLabel("x",118,1,12,14,513),0);,0x100000),0);ex_parentdrag GUICtrlSetBkColor(-1,0xFF0000) ;GUICtrlSetOnEvent(-1,"_Exit") GUICtrlSetColor(-1,0xFFFFFF) GUICtrlSetTip(-1,"Exit") GUICtrlSetFont(-1,9) GUICtrlSetBkColor(GUICtrlCreateLabel("",0,16,130,2),0xF20000);,-1,0x100000),0xF20000);ex_parentdrag GUISetOnEvent(-7,"_Drag") GUISetState() while sleep(20) wend Func _Drag() DllCall("user32.dll","int","SendMessage","hwnd",@GUI_WinHandle,"int",274,"int",0xF012,"int",0) EndFunc . here the gui will move with the mouse as long as left mouse button is pressed over the gui ("-7"). (good for touch screens) Edit: only in on-event-mode of course Edit: sorry had to edit the code 100 times. should be ok now Edited August 6, 2013 by Edano Wombat 1 [color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font] Link to comment Share on other sites More sharing options...
Wombat Posted August 8, 2013 Author Share Posted August 8, 2013 (edited) expandcollapse popup#region ; Includes #include <ButtonConstants.au3> #include <EditConstants.au3> #include <GDIPlus.au3> #include <WindowsConstants.au3> #include <GuiConstantsEx.au3> #include <StaticConstants.au3> #include <Constants.au3> #include <Array.au3> #endregion ; Includes Opt("GUIOnEventMode", 1) #region;;;;;;GUI Section;;;;;;; Global $sFile = "C:\prog_res\Lab\test_res\ciik.png" Global Const $AC_SRC_ALPHA = 1 Global $iWidth, $iHeight, $hRegion Global $___hNew_WndProc, $___pNew_WndProc, $___pOld_WndProc _GDIPlus_Startup() $s_Bitmap = $sFile $hLayeredGUI = _GUICreate_Alpha("End-Hancer", $s_Bitmap, $iWidth, $iHeight) GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST") GUISetState() ;show the main gui ;when the background color and the transcolor are the same of a layered GUI we receive transparent background ;this would create an invisible window $hControls_GUI = GUICreate("ControlGUI", $iWidth, $iHeight, 0, 0, $WS_POPUP, BitOR($WS_EX_MDICHILD, $WS_EX_LAYERED), $hLayeredGUI) GUISetBkColor(0xABCDEF) _WinAPI_SetLayeredWindowAttributes($hControls_GUI, 0xABCDEF, 230) ;set transparency to 230 ;the close button you can use icon also $iCloseButton = GUICtrlCreateLabel("X", 175, 260, 10, 10) GUICtrlSetCursor(-1, 0) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetOnEvent(-1, "CloseGUI") ;now lets create the so required controls to sync the user interaction $iProgressBar = GUICtrlCreateProgress(200, 450, 360, 15) GUICtrlSetState(-1, $GUI_HIDE) GUICtrlSetData(-1, 100) ;set the initial position of the progress to 20 #Region ; Menu Global $iCheckUpdates = GUICtrlCreateLabel("Check For Updates", 250, 350, 140, 18, BitOR($SS_SUNKEN,$WS_BORDER)) GUICtrlSetFont(-1, 10, 1000, 4, "MS Sans Serif") GUICtrlSetCursor(-1, 0) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetOnEvent(-1, "UpdateVersion") Global $iGraphicsConfig = GUICtrlCreateLabel("Graphics Config", 425, 350, 115, 18, BitOR($SS_SUNKEN,$WS_BORDER)) GUICtrlSetFont(-1, 10, 1000, 4, "MS Sans Serif") GUICtrlSetCursor(-1, 0) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetOnEvent(-1, "Opti_Options") Global $iMLConfig = GUICtrlCreateLabel("Launcher Config", 575, 350, 160, 18, BitOR($SS_SUNKEN,$WS_BORDER)) GUICtrlSetFont(-1, 10, 1000, 4, "MS Sans Serif") GUICtrlSetCursor(-1, 0) GUICtrlSetColor(-1, 0xFFFFFF) GUICtrlSetOnEvent(-1, "LauncherOptions") #endregion ; Menu $iDataBox = GUICtrlCreateGroup("", 250, 450, 300, 200) ;;;;;;;;; GUISetState() ;show the controls window ;;;;;;;;; Local $iMsg, $aInfo, $f_ClkThrough = False While 1 $aInfo = GUIGetCursorInfo($hControls_GUI) If @error Then ContinueLoop ;enable clickthrough for the invisible control gui If $aInfo[4] = 0 And $f_ClkThrough = False Then _WinSetClickThrough($hControls_GUI) $f_ClkThrough = True ElseIf $aInfo[4] And $f_ClkThrough Then _WinSetClickThrough($hControls_GUI, False) $f_ClkThrough = False EndIf WEnd #region ;Version check and update Func UpdateVersion() GUICtrlSetBkColor($iCheckUpdates,0x6E6E6E) GUICtrlSetBkColor($iMLConfig,0xABCDEF) GUICtrlSetBkColor($iGraphicsConfig,0xABCDEF) EndFunc ;==>UpdateVersion #endregion ;Version check and update #region ;About and help Func AboutInfo() EndFunc ;==>AboutInfo Func HelpInfo() EndFunc ;==>HelpInfo #endregion ;About and help #region ;Options section Func LauncherOptions() GUICtrlSetBkColor($iMLConfig,0x6E6E6E) GUICtrlSetBkColor($iCheckUpdates,0xABCDEF) GUICtrlSetBkColor($iGraphicsConfig,0xABCDEF) EndFunc Func Opti_Options() GUICtrlSetBkColor($iGraphicsConfig,0x6E6E6E) GUICtrlSetBkColor($iMLConfig,0xABCDEF) GUICtrlSetBkColor($iCheckUpdates,0xABCDEF) EndFunc #endregion Func CloseGUI() GUIDelete("End-Hancer") Exit EndFunc Func WM_NCHITTEST($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam Return $HTCAPTION EndFunc ;==>WM_NCHITTEST Func _WinSetClickThrough($hWin, $iCLickThrough = True) Local $iExStyle = GUIGetStyle($hWin) $iExStyle = $iExStyle[1] If $iCLickThrough Then $iExStyle = BitOR($iExStyle, BitOR($GUI_WS_EX_PARENTDRAG, $WS_EX_TRANSPARENT)) Else $iExStyle = BitOR($iExStyle, BitOR($GUI_WS_EX_PARENTDRAG, $WS_EX_TRANSPARENT)) EndIf Return GUISetStyle(Default, $iExStyle) EndFunc ;==>_WinSetClickThrough ;I have not created the following functions.. Func _GUICreate_Alpha($sTitle, $sPath, ByRef $iWidth, ByRef $iHeight, $iX = -1, $iY = -1, $iOpacity = 255) Local $hGUI, $hImage, $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend $hImage = _GDIPlus_ImageLoadFromFile($sPath) $iWidth = _GDIPlus_ImageGetWidth($hImage) $iHeight = _GDIPlus_ImageGetHeight($hImage) $hGUI = GUICreate($sTitle, $iWidth, $iHeight, $iX, $iY, $WS_POPUP, $WS_EX_LAYERED) SetBitmap($hGUI, $hImage, $iOpacity) _GDIPlus_ImageDispose($hImage) Return $hGUI EndFunc ;==>_GUICreate_Alpha Func SetBitmap($hGUI, $hImage, $iOpacity) Local $hScrDC, $hMemDC, $hBitmap, $hOld, $pSize, $tSize, $pSource, $tSource, $pBlend, $tBlend $hScrDC = _WinAPI_GetDC(0) $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC) $hBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hImage) $hOld = _WinAPI_SelectObject($hMemDC, $hBitmap) $tSize = DllStructCreate($tagSIZE) $pSize = DllStructGetPtr($tSize) DllStructSetData($tSize, "X", _GDIPlus_ImageGetWidth($hImage)) DllStructSetData($tSize, "Y", _GDIPlus_ImageGetHeight($hImage)) $tSource = DllStructCreate($tagPOINT) $pSource = DllStructGetPtr($tSource) $tBlend = DllStructCreate($tagBLENDFUNCTION) $pBlend = DllStructGetPtr($tBlend) DllStructSetData($tBlend, "Alpha", $iOpacity) DllStructSetData($tBlend, "Format", $AC_SRC_ALPHA) _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, $ULW_ALPHA) _WinAPI_ReleaseDC(0, $hScrDC) _WinAPI_SelectObject($hMemDC, $hOld) _WinAPI_DeleteObject($hBitmap) _WinAPI_DeleteDC($hMemDC) EndFunc ;==>SetBitmap #endregion;;;;;;GUI Section;;;;;;; So I had to dd the $GUI_WS__EX_PARENTDRAG to Func _WinSetClickThrough($hWin, $iCLickThrough = True) Local $iExStyle = GUIGetStyle($hWin) $iExStyle = $iExStyle[1] If $iCLickThrough Then $iExStyle = BitOR($iExStyle, BitOR($GUI_WS_EX_PARENTDRAG, $WS_EX_TRANSPARENT)) Else $iExStyle = BitOR($iExStyle, BitOR($GUI_WS_EX_PARENTDRAG, $WS_EX_TRANSPARENT)) EndIf Return GUISetStyle(Default, $iExStyle) EndFunc ;==>_WinSetClickThrough because adding it anywhere else failed miserably..... Adding it as such in the above code made the control GUI drag the parent as it should.. BUT not the controls cannot be clicked on... is this a bug??? Edited August 8, 2013 by Wombat Just look at us.Everything is backwards; everything is upside down. Doctors destroy health. Lawyers destroy justice. Universities destroy knowledge. Governments destroy freedom. The major media destroy information and religions destroy spirituality. ~ Michael Ellner The internet is our one and only hope at a truly free world, do not let them take it from us... 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