Solved

Detecting if an application is hung

Posted on 2000-05-02
10
305 Views
Last Modified: 2010-04-04
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')

0
Comment
Question by:moonrise
  • 2
  • 2
  • 2
  • +4
10 Comments
 
LVL 4

Expert Comment

by:mhervais
ID: 2772089
listening
0
 
LVL 20

Accepted Solution

by:
Madshi earned 50 total points
ID: 2772368
It doesn't matter which window you're using, cause if the main thread is hanging, the message loop simply doesn't process and that means that *no* window will respond.
You can't make anything wrong though, if you always use the window that is shown in the taskbar.

Regards, Madshi.
0
 
LVL 3

Expert Comment

by:smurff
ID: 2772726
listening
0
 
LVL 2

Expert Comment

by:mullet_attack
ID: 2772905
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.
0
 
LVL 3

Expert Comment

by:bryan7
ID: 2774682
it can be done I'm sure.. even unhung it sometimes.. Norton Utilities 3 has a program to do so..
0
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 

Expert Comment

by:penich
ID: 2775871
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




0
 

Expert Comment

by:penich
ID: 2775877
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



0
 

Author Comment

by:moonrise
ID: 2776269
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)?
0
 
LVL 2

Expert Comment

by:mullet_attack
ID: 2776365
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.
0
 

Author Comment

by:moonrise
ID: 2783930
Thank you all.
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now