Page 1 of 1

need to detect a hanging application

Posted: Fri Jun 10, 2011 12:26 am
by broozar
i use a small purebasic-tool to launch a game application. if that application crashes, it should relaunch the game.
but if the game hangs, or it has recently crashed but does not register as not-running because that stupid "app has crashed/stopped working" box is blocking it, IsProgram and ProgramRunning seem to be useless.

i found a registry key for vista/7 to disable that box, however it's certainly not a nice thing to do, and it does not work on xp.

i'd really appreciate if somebody could help me out here.

Re: need to detect a hanging application

Posted: Fri Jun 10, 2011 3:26 am
by IdeasVacuum
You need to enumerate all the processes and test for activity. I have not done this using PB, but I expect someone on this forum has.

Re: need to detect a hanging application

Posted: Fri Jun 10, 2011 7:40 am
by broozar
good call. i can enumerate all processes by using PBOSL_Process, but how can i scan it for activity?

Re: need to detect a hanging application

Posted: Fri Jun 10, 2011 9:09 am
by c4s
Maybe it helps, try IsHungAppWindow_() -> http://msdn.microsoft.com/en-us/library ... 85%29.aspx

Re: need to detect a hanging application

Posted: Mon Aug 22, 2011 6:36 pm
by SFSxOI
You can also check the process thread activity, if there is no activity in the thread then its hung most likely. The majority of games have lots of activity in their threads just setting idle.