Jump to content

Detecting Unresponsive Program


death pax
 Share

Recommended Posts

If its frozen, then no amount of software will resurrect it. There are plugin cards available that have a 'watchdog timer' that will reboot the system unless a regular prompt is received from a program. If your system locks up, the prompt doesn't come, the timer runs out, and boom - reboot! From recollection, these cards are only a few dollars - you don't need the very fancy ones.

Link to comment
Share on other sites

NOT A WORKING SOLUTION (but some ideas)

based on http://www.thescarms.com/VBasic/AppResponse.asp

Const $SMTO_BLOCK = 0x1, $SMTO_ABORTIFHUNG = 0x2
$PID = ProcessExists("notepad.exe") 
$HWND = WinGetHandle(_ProcessGetFirstWinTitle($PID))

$lReturn = DllCall("user32.dll","long","SendMessageTimeoutA", "long",$HWND, "long",0, "long",0, "long",0, _
                    "long", BitAnd($SMTO_BLOCK,$SMTO_ABORTIFHUNG), "long",1000, "long",0)

MsgBox(4096,"Status...", $lReturn[0])

If you have the task manager running, you could read the value of the Status column with some of the user defined functions for reading SysListView's

Use Mozilla | Take a look at My Disorganized AutoIt stuff | Very very old: AutoBuilder 11 Jan 2005 prototype I need to update my sig!
Link to comment
Share on other sites

This actually goes hand in hand with my PID to Hwnd question

i did edit the _processgetfirstwintitle a bit, because i already had the proper pid from when i started server with Run()

Func _ProcessGetFirstWinTitle($pid)
  local $testpid
  local $winlist
 ; Get window list
   $winList = WinList()
; Find which windows go with this process
   For $i = 0 To $winList[0][0] - 1
      $testPid = WinGetProcess($winList[$i][1])
      If $testPid = $pid Then
         Return $winList[$i][0]
      EndIf
   Next
   Return 0
EndFunc

$uHwnd=WinGetHandle(_ProcessGetFirstWinTitle($UnrealId))

then i checked a few things, and noticed that when the server is frozen, wingetclasslist and wingettext return empty strings, so i will check hangs that way ^.^ thanks for the help cyber

Edited by death pax
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...