Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Task Manager End task

Posted on 2006-10-30
4
Medium Priority
?
173 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 1000 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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

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

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…
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…
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…
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…
Suggested Courses

927 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