If it's interesting, you can test one fragment from my "hot reserve".
This code is based on undocumented functions in User32.Dll.
Code:
#Compile Exe #Dim All #Register None #Include "Win32Api.Inc" $AppTitle = "Ltr" ' <--------------- Change me Declare Function MySubCall(hWnd As Long) As Long Function PbMain Dim hWnd As Long, hUser32 As Long Do hWnd = FindWindow (ByVal %Null, $AppTitle) If IsWindow(hWnd) = %False Then Exit Do hUser32 = GetModuleHandle("user32.dll") If hUser32 = 0 Then Exit Do Dim IsHungAppWindow As Dword, IsHungThread As Dword Dim os As OSVERSIONINFO os.dwOSVersionInfoSize = SizeOf(os) GetVersionEx ByVal VarPtr(os) Dim IsHung As Long If IsTrue(os.dwPlatformId = %VER_PLATFORM_WIN32_NT) Then IsHungAppWindow = GetProcAddress(hUser32, "IsHungAppWindow") If IsHungAppWindow = 0 Then Exit Do Call Dword IsHungAppWindow Using MySubCall(100) To IsHung Else IsHungThread = GetProcAddress(hUser32, "IsHungThread") If IsHungThread = 0 Then Exit Do Dim ThreadId As Long ThreadId = GetWindowThreadProcessId(hWnd, %Null) Call Dword IsHungThread Using MySubCall(ThreadId) To IsHung End If If IsTrue(IsHung) Then IsHung = 2 Else IsHung = 1 Exit Do Loop Select Case IsHung Case 0: MsgBox "Not found" Case 1: MsgBox "Running" Case 2: MsgBox "Not responding" End Select End Function
Leave a comment: