Solved

Task Manager End task

Posted on 2006-10-30
4
164 Views
Last Modified: 2013-12-03
Hi,

I have developed an application using D7 that monitors time used on the computer.
When a user uses Windows Task Manager to close my application while my application is in the running state (i.e. the status is not "Not responding", it is still "Running") does Windows send a message to my application that I can respond to and possibly cancel the close command.
I will be glad to have some information on this issue.

Thank you
0
Comment
Question by:martbase
  • 2
4 Comments
 
LVL 28

Accepted Solution

by:
TName earned 250 total points
ID: 17838109
0
 
LVL 28

Expert Comment

by:TName
ID: 17838177
You could also/additionally use a second small process that just checks regurarly if the main application is still running. Logging the status (e.g. every minute) would also be worth considering.
0
 

Author Comment

by:martbase
ID: 18034798
Thanks a lot TName,

I found the link to PAQ very helpful especially Madshi's solution which is quite elegant. My application is multi-threaded so I believe his solution will be perfect me. My only concern is that when the application gets terminated using Task manager, will the application handle in the call to "WaitForSingleObject(Application.Handle, INFINITE)" still be valid? Could I possibly get a working example that has already been tested. Also if the Application object is still valid I have this idea that I could relaunch the application since I can get its filename from the application object! Is there any danger in launching my application from one of its threads?
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
Communication Between RC4 Delphi <-> PHP 3 99
Windows 7 - Fuzzy Fonts 11 68
Delphi 2 47
tvirtualstringtree freeze when load too manny images 10 52
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…
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…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This is a video describing the growing solar energy use in Utah. This is a topic that greatly interests me and so I decided to produce a video about it.

919 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

21 Experts available now in Live!

Get 1:1 Help Now