Last active
December 6, 2017 14:02
-
-
Save TheDcoder/ab25ba0677cb38c502a23b274393b161 to your computer and use it in GitHub Desktop.
IsWindowNotResponding
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <WinAPISys.au3> | |
; #FUNCTION# ==================================================================================================================== | |
; Name ..........: IsWindowNotResponding | |
; Description ...: Checks if a Window is not responding | |
; Syntax ........: IsWindowNotResponding($hWindow[, $iTimeout = 5000]) | |
; Parameters ....: $hWindow - A window handle. | |
; $iTimeout - [optional] Shouldn't matter, Timeout in milliseconds. Default is 5000. | |
; Return values .: @error set by _WinAPI_SendMessageTimeout | |
; Author ........: Damon Harris (TheDcoder) | |
; Remarks .......: The way it works is that it exploits SendMessageTimeout's SMTO_ABORTIFHUNG option. | |
; Do more research on Process.Responding and how it works (C# function for checking if a window is responding) | |
; Link ..........: https://git.io/vbcvJ | |
; Example .......: If IsWindowNotResponding($hWindow) Then DoSomething() | |
; =============================================================================================================================== | |
Func IsWindowNotResponding($hWindow, $iTimeout = 5000) | |
_WinAPI_SendMessageTimeout($hWindow, 0, 0, 0, $iTimeout, $SMTO_ABORTIFHUNG) | |
Return @error | |
EndFunc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment