Solved

Detecting if an application is hung

Posted on 2000-05-02
10
316 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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
 

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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

687 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