Solved

Detecting if an application is hung

Posted on 2000-05-02
10
306 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
TVirtualStringTree  search using TEdit 7 106
proper way to parse text with delphi 7 101
delphi prevent click fast 2 189
Graphics32 under Delphi 10.1 Berlin 2 36
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…
In my programming career I have only very rarely run into situations where operator overloading would be of any use in my work.  Normally those situations involved math with either overly large numbers (hundreds of thousands of digits or accuracy re…
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

911 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

22 Experts available now in Live!

Get 1:1 Help Now