Shirdish_chakravarthi Posted November 6, 2017 Posted November 6, 2017 Hello Guys i am working on automating a flashing tool..When flashing is started if there is any error in connection it pops's up a error window...(as shown below) whenever this popup appears i need a msgbox to appear saying "error occured" how can i do this? Thanks
Danyfirex Posted November 6, 2017 Posted November 6, 2017 Hello. You can do something like this. expandcollapse popup#include <GUIConstantsEx.au3> #include <WinAPIEx.au3> HotKeySet("{ESC}", "_Exit") Global $hGUI=0 Example() Func Example() $hGUI = GUICreate('DummyGUI') ; Create a Dummy GUI. GUIRegisterMsg(_WinAPI_RegisterWindowMessage('SHELLHOOK'), 'WM_SHELLHOOK') ; Define a window message and assign to the WM_SHELLHOOK function. _WinAPI_RegisterShellHookWindow($hGUI) ; Register the shell hook message to our GUI. While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE ExitLoop EndSwitch WEnd _WinAPI_DeregisterShellHookWindow($hGUI) GUIDelete($hGUI) EndFunc ;==>Example Func WM_SHELLHOOK($hWnd, $iMsg, $wParam, $lParam) #forceref $iMsg Local $sTitle = "" Local $iPID = 0 Local $sMessageBoxText = "" Switch $wParam Case $HSHELL_WINDOWCREATED $sTitle = WinGetTitle($lParam) $iPID = WinGetProcess($lParam) $sMessageBoxText = ControlGetText($lParam, "","Static2") If $sTitle = "dps" Then ;~ ControlClick($lParam,"","Button1");Click automatically In Ok Button MsgBox(0, "", "MessageBox Window Detected" & @CRLF & "MessageBox Text: " & $sMessageBoxText) EndIf EndSwitch EndFunc ;==>WM_SHELLHOOK Func _Exit() _WinAPI_DeregisterShellHookWindow($hGUI) GUIDelete($hGUI) Exit EndFunc ;==>_Exit Saludos Shirdish_chakravarthi 1 Danysys.com AutoIt... UDFs: VirusTotal API 2.0 UDF - libZPlay UDF - Apps: Guitar Tab Tester - VirusTotal Hash Checker Examples: Text-to-Speech ISpVoice Interface - Get installed applications - Enable/Disable Network connection PrintHookProc - WINTRUST - Mute Microphone Level - Get Connected NetWorks - Create NetWork Connection ShortCut
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