Sign in to follow this  
Followers 0
death pax

Detecting Unresponsive Program

6 posts in this topic

I run a game server on my computer, and i use an autoit program to restart it if it crashes, using processexists(), however I dont know how to restart it if the server freezes(and becomes unresponsive). Any suggestions?

Share this post


Link to post
Share on other sites



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.

Share this post


Link to post
Share on other sites

no, what i mean is the program freezes, not the system

Share this post


Link to post
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!

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

yes, but i was hoping to do it with out taskman.... any idea one what dll calls taskman uses? or if its all self contained?

also, where did you get the function _ProcessGetFirstWinTitle? ;)

nevermind, found it :P

Edited by death pax

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

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

Share this post


Link to post
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
Sign in to follow this  
Followers 0