Hey there
some times in a big script like mine, unpredictable errors come out and crashes it, is there anyway to handle any error in the script with a message box or event instead of viewing an "AutoIt error" and closing the application?
I hope so, thank you.
Here, let me then:
#include <WinApi.au3>
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
AddHookApi("user32.dll", "MessageBoxW", "Intercept_MessageBoxW", "int", "hwnd;wstr;wstr;uint")
Func Intercept_MessageBoxW($hWnd, $sText, $sTitle, $iType)
Local $aCall = DllCall("user32.dll", "int", "MessageBoxW", _
"hwnd", $hWnd, _
"wstr", $sText, _
"wstr", StringReplace($sTitle, "AutoIt", @ScriptName), _
"uint", $iType)
If @error Or Not $aCall[0] Then Return 0
Return $aCall[0]
EndFunc
;;;;;;;