Link to home
Start Free TrialLog in
Avatar of moonrise
moonrise

asked on

Detecting if an application is hung

I want one application to detect if another application is hung. I think I need to use SendMessageTimeout.

Question: what handle should I use - the application handle with FindWindow('TApplication', 'ApplicationTitle') Ā or FindWindow('TFormClass', 'FormTitle')

Avatar of mhervais
mhervais

listening
ASKER CERTIFIED SOLUTION
Avatar of Madshi
Madshi

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
listening
You don't say if you have the source to the app you want to monitor. If you do then...

If I needed to detect if an application was hung using a special monitor program, I would make the app periodically send a message to the monitor, and the monitor would send a message back acknowledging. That way if the main app hung, the monitor would not get messages and could take action. Also, the main app would know if the monitor had hung.

If not, then hard to detect if an app has hung. It may appear to be hung from user perspective, but most times it isn't dead, it's just off doing something with the fairies. The message loop may still work, as evident in 98 or NT when you selected 'end task', sometimes the app will do a 'proper' shutdown.
it can be done I'm sure.. even unhung it sometimes.. Norton Utilities 3 has a program to do so..
Well
See At the Next Function
FindWindow
What is the Window in DELPHI
it is class
Theeeen
Obviously
You must use
FindWindow('TFormClass', 'FormTitle')
By




Well
See At the Next Function
FindWindow
What is the Window in DELPHI
it is class
Theeeen
Obviously
You must use
FindWindow('TFormClass', 'FormTitle')
By
If you need i can send example to you



Avatar of moonrise

ASKER

Thank you. I write both aplications, but what would be the advantage of sending messages to the application that does the monitoring (instead of using SendMessageTimeout)?
the monitor program waits for messages from the main app, which must come at regular intervals, otherwise we have a main app failure. The response from the monitor to the main app is an insurance policy. If you have an app that needs to be monitored it must be important, but if Monitor fails, and then main app fails no-one will know. Using my scenario, failure of either will be noticed.

Either way is not wrong, just different ways to achieve the goal.
Thank you all.