Jump to content

This site uses cookies. By continuing to browse the site you are agreeing to our use of cookies. Find out more here. X
X


Photo

_GUIDisable() - Create a dimmed effect on a GUI.


  • Please log in to reply
70 replies to this topic

#1 guinness

guinness

    I've a handle on the fiction

  • Developers
  • 15,708 posts

Posted 08 March 2011 - 06:03 PM

I was inspired by an example in s!mpL3 LAN Messenger, in which when you wanted to change the Password the current GUI had a dimmed effect until the Password was set.

I therefore decided to create _GUIDisable which creates the same effect. I also utilised a Function mentioned by Mat and created by Yashied in the _GetControlID() topic.

Example:
Posted Image

Simple GUIDisable without the Global Variable & Re-Sizing or continue for those interested in the original UDF with more options ...

UDF with Global variable:
AutoIt         
#include-once ; #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 ; #INDEX# ======================================================================================================================= ; Title .........: _GUIDisable ; AutoIt Version : v3.2.2.0 or higher ; Language ......: English ; Description ...: Creates a dimming effect on the current/selected GUI. ; Note ..........: ; Author(s) .....: guinness ; Remarks .......: Thanks to supersonic for the idea of adjusting the UDF when using Classic themes in Windows Vista+. ; =============================================================================================================================== ; #INCLUDES# ==================================================================================================================== #include <GUIConstantsEx.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> ; #GLOBAL VARIABLES# ============================================================================================================ Global Enum $__hGUIDisableHWnd, $__hGUIDisableHWndPrevious, $__iGUIDisableMax Global $__aGUIDisable[$__iGUIDisableMax] ; #CURRENT# ===================================================================================================================== ; _GUIDisable: Creates a dimming effect on the current/selected GUI. ; =============================================================================================================================== ; #INTERNAL_USE_ONLY#============================================================================================================ ; __GUIDisable_WM_SIZE: Automatically re-sizes the dimmed effect when the GUI is re-sized. ; =============================================================================================================================== ; #FUNCTION# ==================================================================================================================== ; Name ..........: _GUIDisable ; Description ...: Creates a dimming effect on the current/selected GUI. ; Syntax ........: _GUIDisable($hWnd[, $iAnimate = 1[, $iBrightness = 5[, $bColor = 0x000000]]]) ; Parameters ....: $hWnd             - GUI handle the effect should be applied to. This can either be a variable of the GUI handle or -1 for the current GUI. ;                  $iAnimate            - [optional] Animate the dimmed effect. Animate = 1 or don't animate = 0. Default is 1. ;                  $iBrightness         - [optional] Percentage of how bright the effect is. Default is 5. ;                  $bColor              - [optional] Color of the dimming effect. Default is 0x000000. ; Return values .: Success - Returns handle of dimmed GUI. ;                  Failure - Returns 0 and sets @error to non-zero ; Author ........: guinness ; Example .......: Yes ; =============================================================================================================================== Func _GUIDisable($hWnd, $iAnimate = Default, $iBrightness = Default, $bColor = 0x000000)     Local Const $AW_SLIDE_IN_TOP = 0x00040004, $AW_SLIDE_OUT_TOP = 0x00050008     If $iAnimate = Default Then         $iAnimate = 1     EndIf     If $iBrightness = Default Then         $iBrightness = 5     EndIf     If $hWnd = -1 And $__aGUIDisable[$__hGUIDisableHWnd] = 0 Then         Local $iLabel = GUICtrlCreateLabel('', -99, -99, 1, 1)         $hWnd = _WinAPI_GetParent(GUICtrlGetHandle($iLabel))         If @error Then             Return SetError(1, 0 * GUICtrlDelete($iLabel), 0)         EndIf         GUICtrlDelete($iLabel)     EndIf     If IsHWnd($__aGUIDisable[$__hGUIDisableHWnd]) Then         If $iAnimate Then             DllCall('user32.dll', 'int', 'AnimateWindow', 'hwnd', $__aGUIDisable[$__hGUIDisableHWnd], 'dword', 250, 'dword', $AW_SLIDE_OUT_TOP)         EndIf         GUIDelete($__aGUIDisable[$__hGUIDisableHWnd])         GUISwitch($__aGUIDisable[$__hGUIDisableHWndPrevious])         $__aGUIDisable[$__hGUIDisableHWnd] = 0         $__aGUIDisable[$__hGUIDisableHWndPrevious] = 0     Else         $__aGUIDisable[$__hGUIDisableHWndPrevious] = $hWnd         Local $iLeft = 0, $iTop = 0         Local $sCurrentTheme = RegRead('HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Themes', 'CurrentTheme')         Local $iIsClassicTheme = Number(StringInStr($sCurrentTheme, 'Basic.theme', 2) = 0 And StringInStr($sCurrentTheme, 'Ease of Access Themes', 2) > 0)         Local $aStyle = GUIGetStyle($__aGUIDisable[$__hGUIDisableHWndPrevious])         If UBound($aStyle) Then             If BitAND($aStyle[0], $WS_SIZEBOX) Then                 If RegRead('HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\', 'CurrentVersion') >= 6.0 Then ; Windows Vista+.                     If $iIsClassicTheme Then                         $iLeft -= 1                         $iTop -= 1                     Else                         $iLeft -= 5                         $iTop -= 5                     EndIf                 Else                     $iLeft -= 1                     $iTop -= 1                 EndIf             EndIf         EndIf         Local $aWinGetPos = WinGetClientSize($__aGUIDisable[$__hGUIDisableHWndPrevious])         $__aGUIDisable[$__hGUIDisableHWnd] = GUICreate('', $aWinGetPos[0], $aWinGetPos[1], $iLeft, $iTop, $WS_POPUP, $WS_EX_MDICHILD, $__aGUIDisable[$__hGUIDisableHWndPrevious])         GUISetBkColor($bColor, $__aGUIDisable[$__hGUIDisableHWnd])         WinSetTrans($__aGUIDisable[$__hGUIDisableHWnd], '', Round($iBrightness * (255 / 100)))         GUIRegisterMsg($WM_SIZE, '__GUIDisable_WM_SIZE')         If $iAnimate Then             DllCall('user32.dll', 'int', 'AnimateWindow', 'hwnd', $__aGUIDisable[$__hGUIDisableHWnd], 'dword', 250, 'dword', $AW_SLIDE_IN_TOP)         Else             GUISetState(@SW_SHOW, $__aGUIDisable[$__hGUIDisableHWnd])         EndIf         GUISetState(@SW_DISABLE, $__aGUIDisable[$__hGUIDisableHWnd])         GUISwitch($__aGUIDisable[$__hGUIDisableHWndPrevious])     EndIf     Return $__aGUIDisable[$__hGUIDisableHWnd] EndFunc   ;==>_GUIDisable ; #INTERNAL_USE_ONLY#============================================================================================================ Func __GUIDisable_WM_SIZE($hWnd, $iMsg, $wParam, $lParam)     #forceref $hWnd, $iMsg, $wParam     Local $iHeight = _WinAPI_HiWord($lParam)     Local $iWidth = _WinAPI_LoWord($lParam)     If $hWnd = $__aGUIDisable[$__hGUIDisableHWndPrevious] Then         Local $iWinGetPos = WinGetPos($__aGUIDisable[$__hGUIDisableHWnd])         If @error = 0 Then             WinMove($__aGUIDisable[$__hGUIDisableHWnd], '', $iWinGetPos[0], $iWinGetPos[1], $iWidth, $iHeight)         EndIf     EndIf     Return $GUI_RUNDEFMSG EndFunc   ;==>__GUIDisable_WM_SIZE

Example 1:
AutoIt         
#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 -w 7 #include <Constants.au3> #include '_GUIDisable.au3' Example_1() Func Example_1()     Local $hGUI = GUICreate('_GUIDisable()', 300, 100, -1, -1, BitXOR($GUI_SS_DEFAULT_GUI, $WS_SIZEBOX, $WS_MINIMIZEBOX))     Local $iButton_1 = GUICtrlCreateButton('Effect 1', 5, 5, 100, 25)     GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKSIZE + $GUI_DOCKTOP)     Local $iButton_2 = GUICtrlCreateButton('Effect 2', 5, 30, 100, 25)     GUICtrlSetResizing(-1, $GUI_DOCKLEFT + $GUI_DOCKSIZE + $GUI_DOCKTOP)     GUISetState(@SW_SHOW, $hGUI)     Local $hDisableGUI = 0, $hTimer = 0     While 1         Switch GUIGetMsg()             Case $GUI_EVENT_CLOSE                 ExitLoop             Case $iButton_1                 ; Enable the dimmed effect on the current GUI with the animation turned on.                 _GUIDisable(-1, 1, 25)                 MsgBox($MB_SYSTEMMODAL, '_GUIDisable()', 'See how the GUI is now dimmed. Once you select OK, you''ll have 5 seconds to re-size the GUI!' & @CRLF & @CRLF & _                         'If you wish to exit the 5 second timer, then simply select "Close" to exit the loop.')                 $hTimer = TimerInit()                 Do                     ; Exit the loop if $GUI_EVENT_CLOSE is captured by GUIGetMsg().                     If GUIGetMsg() = $GUI_EVENT_CLOSE Then                         ExitLoop                     EndIf                     Sleep(10)                 Until TimerDiff($hTimer) > 5000                 ; Disable the dimmed effect with the animation turned on and add focus to the current GUI.                 _GUIDisable(-1, 1)             Case $iButton_2                 ; Enable the dimmed effect on the current GUI without the animation.                 $hDisableGUI = _GUIDisable($hGUI, 0, 25, 0x7D26CD)                 ; Pass handle of dimmed GUI to the MsgBox, just the same as passing $hGUI.                 MsgBox($MB_SYSTEMMODAL, '_GUIDisable(' & $hGUI & ')', 'See how the GUI is now dimmed with a Purple color.', 0, $hDisableGUI)                 ; Disable the dimmed effect without the animation and add focus back to the previous GUI.                 _GUIDisable($hGUI, 0)         EndSwitch     WEnd     GUIDelete($hGUI) EndFunc   ;==>Example_1

All of the above has been included in a ZIP file. Attached File  GUIDisable.zip   4.13KB   309 downloads
Previous downloads: 420+.

Updated: 01/02/2013

Edited by guinness, 01 February 2013 - 02:44 PM.

  • mesale0077 likes this

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUISetIcon()_Icon_Clear()/_Icon_Set()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingFileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIGetBkColor()LockFile()PasswordValidPasteBinPosts Per DayPreExpandQueue()SciTE JumpSHELLHOOKShunting-YardSignature CreatorStack()StringAddLF()/StringStripLF()StringEOLToCRLF()WM_COPYDATAMore Examples...
Updated: 12/04/2014








#2 JScript

JScript

    I'm back ... I miss, why not!

  • Active Members
  • PipPipPipPipPipPip
  • 1,070 posts

Posted 08 March 2011 - 07:24 PM

I copied the script runs but does not see anything happen :)
http://notebook.forumais.com (Forum Maintenance Notebooks and Desktop)http://autoitbrasil.com/ (AutoIt v3 Brazil!!!)
Spoiler

Posted Image Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere!       


#3 AppTux

AppTux

    Adventurer

  • Active Members
  • PipPip
  • 130 posts

Posted 08 March 2011 - 07:35 PM

@jscript that's strange, because I see something happen: the window gets darker... (when the MsgBox is opened)
PowerSlide2UnlockiPhone look-a-like program you can use to lock your pc, you can't access your desktop again until the password is entered and the slider slided to the right. (really proud of it)-- After a time AutoIt and Windows, I switched to Mac. Don't expect me to answer anymore.

#4 guinness

guinness

    I've a handle on the fiction

  • Developers
  • 15,708 posts

Posted 08 March 2011 - 07:44 PM

@jscript, maybe try this to see the difference in "dimness!"
_GUIDisable(-1, 90) ; This is 90% dimmed.

And thanks AppTux for Testing.

Edited by guinness, 08 March 2011 - 07:44 PM.

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUISetIcon()_Icon_Clear()/_Icon_Set()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingFileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIGetBkColor()LockFile()PasswordValidPasteBinPosts Per DayPreExpandQueue()SciTE JumpSHELLHOOKShunting-YardSignature CreatorStack()StringAddLF()/StringStripLF()StringEOLToCRLF()WM_COPYDATAMore Examples...
Updated: 12/04/2014


#5 JScript

JScript

    I'm back ... I miss, why not!

  • Active Members
  • PipPipPipPipPipPip
  • 1,070 posts

Posted 10 March 2011 - 02:33 PM

@jscript, maybe try this to see the difference in "dimness!"

_GUIDisable(-1, 90) ; This is 90% dimmed.

And thanks AppTux for Testing.

Perfect! I think my "Colorblind" not much help... :)
http://notebook.forumais.com (Forum Maintenance Notebooks and Desktop)http://autoitbrasil.com/ (AutoIt v3 Brazil!!!)
Spoiler

Posted Image Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere!       


#6 martin

martin

    ~~\o/~~~/0\=¬''~~~

  • MVPs
  • 7,313 posts

Posted 12 March 2011 - 11:23 AM

Nice effect guinness :)

For me it would be better if the dimming function had parameters passed to it so that it could be used with any gui in the script and it didn't need, or use, global variables.
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

#7 guinness

guinness

    I've a handle on the fiction

  • Developers
  • 15,708 posts

Posted 12 March 2011 - 11:47 AM

parameters passed to it so that it could be used with any gui in the script and it didn't need, or use, global variables.

It's something I could work on, but this was something I put together in 5mins :)

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUISetIcon()_Icon_Clear()/_Icon_Set()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingFileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIGetBkColor()LockFile()PasswordValidPasteBinPosts Per DayPreExpandQueue()SciTE JumpSHELLHOOKShunting-YardSignature CreatorStack()StringAddLF()/StringStripLF()StringEOLToCRLF()WM_COPYDATAMore Examples...
Updated: 12/04/2014


#8 martin

martin

    ~~\o/~~~/0\=¬''~~~

  • MVPs
  • 7,313 posts

Posted 12 March 2011 - 12:02 PM

It's something I could work on, but this was something I put together in 5mins :)


Well I think we could have waited another 5 minutes :)
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

#9 guinness

guinness

    I've a handle on the fiction

  • Developers
  • 15,708 posts

Posted 12 March 2011 - 12:36 PM

_GUIDisable without the Global Variable & Re-Sizing (as suggested by martin.)

UDF without Global variable:
AutoIt         
#include-once ; #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 ; #INDEX# ======================================================================================================================= ; Title .........: _GUIDisable ; AutoIt Version : v3.2.2.0 or higher ; Language ......: English ; Description ...: Creates a dimming effect on the current/selected GUI. ; Note ..........: ; Author(s) .....: guinness ; Remarks .......: ; =============================================================================================================================== ; #INCLUDES# ========================================================================================================= #include <GUIConstantsEx.au3> #include <WinAPI.au3> #include <WindowsConstants.au3> ; #GLOBAL VARIABLES# ================================================================================================= ; None. ; #CURRENT# ===================================================================================================================== ; _GUIDisable: Creates a dimming effect on the current/selected GUI. ; =============================================================================================================================== ; #INTERNAL_USE_ONLY#============================================================================================================ ; None. ; =============================================================================================================================== ; #AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 ; #FUNCTION# ========================================================================================================= ; Name...........: _GUIDisable ; Description ...: Creates a dimming effect on the current/selected GUI. ; Syntax.........: _GUIDisable([$hWnd = -1, [$iDelete = 0, [$iBrightness = 5, [$bColor = 0x000000]]]]) ; Parameters ....: $hWnd  - [Optional] GUI handle the effect should be applied to. Default = -1 (Current GUI handle created) ;                  $iDelete - [Optional] Create or Delete the dimming effect. Default = 0 (Create = 0 & Delete = 1) ;                  $iBrightness - [Optional] Percentage of how bright the effect is. Default = 5% ;                  $bColor - [Optional] Color of the dimming effect. Default = Black ; Requirement(s).: v3.2.2.0 or higher ; Return values .: Success - Returns handle of dimmed GUI or value of GUIDelete(). ;                  Failure - Returns 0 ; Author ........: guinness ; Example........; Yes ;===================================================================================================================== Func _GUIDisable($hWnd = -1, $iDelete = 0, $iBrightness = Default, $bColor = 0x000000)     Local $vGUI = 0     If $iBrightness = Default Then         $iBrightness = 5     EndIf     If $hWnd = -1 Then         Local $iLabel = GUICtrlCreateLabel('', -99, -99, 1, 1)         $hWnd = _WinAPI_GetParent(GUICtrlGetHandle($iLabel))         If @error Then             Return SetError(1, 0 * GUICtrlDelete($iLabel), 0)         EndIf         GUICtrlDelete($iLabel)     EndIf     If $iDelete Then         $vGUI = GUIDelete($hWnd)     Else         Local $aWinGetPos = WinGetClientSize($hWnd)         $vGUI = GUICreate('', $aWinGetPos[0], $aWinGetPos[1], 0, 0, $WS_POPUP, $WS_EX_MDICHILD, $hWnd)         GUISetBkColor($bColor, $vGUI)         WinSetTrans($vGUI, '', Round($iBrightness * (255 / 100)))         GUISetState(@SW_SHOW, $vGUI)     EndIf     Return $vGUI EndFunc   ;==>_GUIDisable

Example 1:
AutoIt         
#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6 #include <WindowsConstants.au3> #include '_GUIDisable.au3' Example_1() Func Example_1()     Local $hGUI = GUICreate('_GUIDisable()', 300, 100, -1, -1, BitXOR($GUI_SS_DEFAULT_GUI, $WS_MINIMIZEBOX))     Local $iButton_1 = GUICtrlCreateButton('Effect 1', 5, 5, 100, 25)     Local $iButton_2 = GUICtrlCreateButton('Effect 2', 5, 30, 100, 25)     GUISetState(@SW_SHOW, $hGUI)     Local $hDisableGUI = 0     While 1         Switch GUIGetMsg()             Case $GUI_EVENT_CLOSE                 ExitLoop             Case $iButton_1                 ; Enable the dimmed effect on the current GUI.                 _GUIDisable(-1, 0, 45)                 MsgBox(4096, '_GUIDisable(' & $hGUI & ')', 'See how the GUI is now dimmed.')                 ; Disable the previously dimmed effect.                 _GUIDisable(-1, 1)             Case $iButton_2                 ; Enable the dimmed effect on the current GUI.                 $hDisableGUI = _GUIDisable(-1, 0, 25, 0x7D26CD)                 ; Pass handle of dimmed GUI to the MsgBox, just the same as passing $GUI.                 MsgBox(4096, '_GUIDisable(' & $hGUI & ')', 'See how the GUI is now dimmed with a Purple color.', 0, $hDisableGUI)                 ; Disable the previously dimmed effect.                 _GUIDisable(-1, 1)         EndSwitch     WEnd     GUIDelete($hGUI) EndFunc   ;==>Example_1

Edited by guinness, 23 September 2012 - 08:59 PM.

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUISetIcon()_Icon_Clear()/_Icon_Set()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingFileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIGetBkColor()LockFile()PasswordValidPasteBinPosts Per DayPreExpandQueue()SciTE JumpSHELLHOOKShunting-YardSignature CreatorStack()StringAddLF()/StringStripLF()StringEOLToCRLF()WM_COPYDATAMore Examples...
Updated: 12/04/2014


#10 martin

martin

    ~~\o/~~~/0\=¬''~~~

  • MVPs
  • 7,313 posts

Posted 13 March 2011 - 12:40 AM

That's a good improvement :)
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.

#11 guinness

guinness

    I've a handle on the fiction

  • Developers
  • 15,708 posts

Posted 17 June 2011 - 08:15 PM

I've just updated _GUIDisable(). It's now packaged together in a ZIP file, included a better looking screenshot and I cleaned up the code. Any suggestions then post below. Thanks.

Edited by guinness, 27 March 2012 - 06:39 PM.

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUISetIcon()_Icon_Clear()/_Icon_Set()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingFileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIGetBkColor()LockFile()PasswordValidPasteBinPosts Per DayPreExpandQueue()SciTE JumpSHELLHOOKShunting-YardSignature CreatorStack()StringAddLF()/StringStripLF()StringEOLToCRLF()WM_COPYDATAMore Examples...
Updated: 12/04/2014


#12 supersonic

supersonic

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 464 posts

Posted 21 June 2011 - 10:41 AM

guinness,

I like your UDF a lot. Thanks for sharing! :huh2:

-supersonic.

#13 supersonic

supersonic

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 464 posts

Posted 21 June 2011 - 10:59 AM

But I have found two little issues:

- When used with a resizable window the dimmed layer is not correctly positioned (e. g. MS Windows 7 with Aero, ~ 2-3 pixels, see top and left side).
- And the dimmed layer will not be correctly resized.

Maybe there could be solutions for these little issues?

-supersonic.

Edited by supersonic, 21 June 2011 - 11:03 AM.


#14 guinness

guinness

    I've a handle on the fiction

  • Developers
  • 15,708 posts

Posted 21 June 2011 - 11:02 AM

Yeh I will update it today or tomorrow. Thanks supersonic.

I've normally just intercepted the sizing of the GUI when _GUIDisable() is enabled, but I can see it being a benefit now.

Edited by guinness, 21 June 2011 - 11:09 AM.

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUISetIcon()_Icon_Clear()/_Icon_Set()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingFileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIGetBkColor()LockFile()PasswordValidPasteBinPosts Per DayPreExpandQueue()SciTE JumpSHELLHOOKShunting-YardSignature CreatorStack()StringAddLF()/StringStripLF()StringEOLToCRLF()WM_COPYDATAMore Examples...
Updated: 12/04/2014


#15 guinness

guinness

    I've a handle on the fiction

  • Developers
  • 15,708 posts

Posted 22 June 2011 - 11:42 PM

Updated with the suggestions by supersonic, Thanks. See the original post for an updated version.

ChangeLog:
ADDED: Animation of the dimmed effect. If enabled it will animate from top to bottom when the dim effect is applied and reverse when removed. ADDED: Re-sizing of the dimmed effect if $WS_SIZEBOX is present as a Style in GUICreate(). FIXED: Alignment issues if $WS_SIZEBOX has been used as a style.

Any suggestions or improvements then please post below. Thanks.

Edited by guinness, 22 June 2011 - 11:42 PM.

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUISetIcon()_Icon_Clear()/_Icon_Set()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingFileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIGetBkColor()LockFile()PasswordValidPasteBinPosts Per DayPreExpandQueue()SciTE JumpSHELLHOOKShunting-YardSignature CreatorStack()StringAddLF()/StringStripLF()StringEOLToCRLF()WM_COPYDATAMore Examples...
Updated: 12/04/2014


#16 guinness

guinness

    I've a handle on the fiction

  • Developers
  • 15,708 posts

Posted 24 June 2011 - 11:07 AM

Updated for those that use multiple GUI's

ChangeLog:
FIXED: If a second GUI was created after _GUIDisable() was enabled, then re-sizing the second GUI would re-size the dimmed effect too. FIXED: If using a second GUI with $WS_POPUP on top of _GUIDisable() would result in the dimmed effect being brought forward if selected, this was solved by setting the state to @SW_DISABLE.

Any suggestions or improvements then please post below. Thanks.

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUISetIcon()_Icon_Clear()/_Icon_Set()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingFileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIGetBkColor()LockFile()PasswordValidPasteBinPosts Per DayPreExpandQueue()SciTE JumpSHELLHOOKShunting-YardSignature CreatorStack()StringAddLF()/StringStripLF()StringEOLToCRLF()WM_COPYDATAMore Examples...
Updated: 12/04/2014


#17 supersonic

supersonic

    Universalist

  • Active Members
  • PipPipPipPipPipPip
  • 464 posts

Posted 29 June 2011 - 06:44 AM

guinness,

thank you, works well.

I found another problem:

Your script seems to work well - but only with one GUI at runtime. In my case I have to handle up to three GUIs at runtime.

Here's my quick-'n'-dirty solution to that issue:

Plain Text         
#include-once #include <Array.au3> #include <WindowsConstants.au3> Func _GUIDisable($hGD_Window, ByRef $aGD_Window, $bGD_Color = 0x000000, $iGD_Transparency = 10)     If IsHWnd($hGD_Window) = 1 Then         If UBound($aGD_Window, 0) = 2 Then             Switch @NumParams                 Case 2 ; Enable.                     Local $iGD_ArraySearch = _ArraySearch($aGD_Window, $hGD_Window, 1, 0, 0, 0, 0, 0)                     If Not @error Then                         GUIDelete($aGD_Window[$iGD_ArraySearch][1])                         GUISetState(@SW_ENABLE, $aGD_Window[$iGD_ArraySearch][0])                         _ArrayDelete($aGD_Window, $iGD_ArraySearch)                         Return SetError(0, 0, 1)                     EndIf                     Return SetError(4, 0, 0)                 Case 3, 4 ; Disable.                     If BitAND(WinGetState($hGD_Window, ""), 2) = True Then                         Local $aGD_WindowPosition = WinGetPos($hGD_Window, "")                         If Not @error And UBound($aGD_WindowPosition) = 4 Then                             Local $hGD_Dummy = GUICreate("", $aGD_WindowPosition[2], $aGD_WindowPosition[3], $aGD_WindowPosition[0], $aGD_WindowPosition[1], BitOR($WS_DISABLED, $WS_POPUP), BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST))                             If Not @error Then                                 ReDim $aGD_Window[UBound($aGD_Window, 1) + 1][UBound($aGD_Window, 2)]                                 $aGD_Window[UBound($aGD_Window) - 1][0] = $hGD_Window                                 $aGD_Window[UBound($aGD_Window) - 1][1] = $hGD_Dummy                                 GUISetBkColor($bGD_Color, $hGD_Dummy)                                 WinSetTrans($hGD_Dummy, "", Round($iGD_Transparency * (255 / 100), 0))                                 GUISetState(@SW_DISABLE, $hGD_Window)                                 GUISetState(@SW_SHOW, $hGD_Dummy)                                 Return SetError(0, 0, 1)                             EndIf                             Return SetError(6, 0, 0)                         EndIf                         Return SetError(5, 0, 0)                     EndIf                     Return SetError(4, 0, 0)             EndSwitch             Return SetError(3, 0, 0)         EndIf         Return SetError(2, 0, 0)     EndIf     Return SetError(1, 0, 0) EndFunc   ;==>_GUIDisable


Although working with an array in this UDF the performance is still good because the array is very small.
A little performance improvement is to check if the window is visible or not before applying the effect.

-supersonic.

Edited by supersonic, 29 June 2011 - 06:45 AM.


#18 guinness

guinness

    I've a handle on the fiction

  • Developers
  • 15,708 posts

Posted 29 June 2011 - 08:05 AM

Your script seems to work well - but only with one GUI at runtime. In my case I have to handle up to three GUIs at runtime.

My initial design brief was for it to be with only 1 GUI at a time because I normally have a "Main" GUI that I always revert back to. If your solution works then great :)

Edited by guinness, 29 June 2011 - 08:06 AM.

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUISetIcon()_Icon_Clear()/_Icon_Set()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingFileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIGetBkColor()LockFile()PasswordValidPasteBinPosts Per DayPreExpandQueue()SciTE JumpSHELLHOOKShunting-YardSignature CreatorStack()StringAddLF()/StringStripLF()StringEOLToCRLF()WM_COPYDATAMore Examples...
Updated: 12/04/2014


#19 guinness

guinness

    I've a handle on the fiction

  • Developers
  • 15,708 posts

Posted 04 October 2011 - 11:41 AM

ChangeLog:
IMPROVED: Source code of the UDF.

Any suggestions or improvements then please post below. Thanks.

Example List: _AdapterConnections()_AlwaysRun()_AppMon()_AppMonEx()_BinaryBin()_CheckMsgBox()_CmdLineRaw()_ContextMenu()_ConvertLHWebColor()/_ConvertSHWebColor()_DesktopDimensions()_DisplayPassword()_Fibonacci()_FileCompare()_FileCompareContents()_FileNameByHandle()_FilePrefix/SRE()_FindInFile()_GetBackgroundColor()/_SetBackgroundColor()_GetConrolID()_GetCtrlClass()_GetDirectoryFormat()_GetDriveMediaType()_GetFilename()/_GetFilenameExt()_GetHardwareID()_GetIP()_GetIP_Country()_GetOSLanguage()_GetSavedSource_GetStringSize()_GetSystemPaths()_GetURLImage()_GIFImage()_GoogleWeather()_GUICtrlCreateGroup()_GUICtrlListBox_CreateArray()_GUICtrlListView_CreateArray()_GUICtrlListView_SaveCSV()_GUICtrlListView_SaveHTML()_GUICtrlListView_SaveTxt()_GUICtrlListView_SaveXML()_GUICtrlMenu_Recent()_GUICtrlMenu_SetItemImage()_GUICtrlTreeView_CreateArray()_GUIDisable()_GUIImageList_SetIconFromHandle()_GUISetIcon()_Icon_Clear()/_Icon_Set()_InetGet()_InetGetGUI()_InetGetProgress()_IPDetails()_IsFileOlder()_IsGUID()_IsHex()_IsPalindrome()_IsRegKey()_IsStringRegExp()_IsUPX()_IsValidType()_IsWebColor()_Language()_Log()_MicrosoftInternetConnectivity()_MSDNDataType()_PathFull/GetRelative/Split()_PathSplitEx()_PrintFromArray()_ProgressSetMarquee()_ReDim()_RockPaperScissors()/_RockPaperScissorsLizardSpock()_ScrollingCredits_SelfDelete()_SelfRename()_SelfUpdate()_SendTo()_ShellAll()_ShellFile()_ShellFolder()_SingletonHWID()_SingletonPID()_Startup()_StringCompact()_StringIsValid()_StringRegExpMetaCharacters()_StringReplaceWholeWord()_StringStripChars()_Temperature()_TrialPeriod()_UKToUSDate()/_USToUKDate()_WinAPI_CreateGUID()_WMIDateStringToDate()/_DateToWMIDateString()Au3 script parsingAutoIt SearchAutoIt3 PortableAutoIt3WrapperToPragmaAutoItWinGetTitle()/AutoItWinSetTitle()CodingFileInstallrGeoIP databaseGUI - Only Close ButtonGUI ExamplesGUICtrlDeleteImage()GUICtrlGetBkColor()GUICtrlGetStyle()GUIGetBkColor()LockFile()PasswordValidPasteBinPosts Per DayPreExpandQueue()SciTE JumpSHELLHOOKShunting-YardSignature CreatorStack()StringAddLF()/StringStripLF()StringEOLToCRLF()WM_COPYDATAMore Examples...
Updated: 12/04/2014


#20 JScript

JScript

    I'm back ... I miss, why not!

  • Active Members
  • PipPipPipPipPipPip
  • 1,070 posts

Posted 04 October 2011 - 12:39 PM

@guinness

When I click the link, go to message #19...

João Carlos.
http://notebook.forumais.com (Forum Maintenance Notebooks and Desktop)http://autoitbrasil.com/ (AutoIt v3 Brazil!!!)
Spoiler

Posted Image Download Dropbox - Simplify your life!Your virtual HD wherever you go, anywhere!       





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users