need to detect a hanging application

Windows specific forum
broozar
User
User
Posts: 61
Joined: Sat May 08, 2010 11:21 pm
Location: Berlin, Germany

need to detect a hanging application

Post 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.
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: need to detect a hanging application

Post 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.
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
broozar
User
User
Posts: 61
Joined: Sat May 08, 2010 11:21 pm
Location: Berlin, Germany

Re: need to detect a hanging application

Post by broozar »

good call. i can enumerate all processes by using PBOSL_Process, but how can i scan it for activity?
c4s
Addict
Addict
Posts: 1981
Joined: Thu Nov 01, 2007 5:37 pm
Location: Germany

Re: need to detect a hanging application

Post by c4s »

Maybe it helps, try IsHungAppWindow_() -> http://msdn.microsoft.com/en-us/library ... 85%29.aspx
If any of you native English speakers have any suggestions for the above text, please let me know (via PM). Thanks!
SFSxOI
Addict
Addict
Posts: 2970
Joined: Sat Dec 31, 2005 5:24 pm
Location: Where ya would never look.....

Re: need to detect a hanging application

Post 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.
The advantage of a 64 bit operating system over a 32 bit operating system comes down to only being twice the headache.
Post Reply