Solved

Task Manager End task

Posted on 2006-10-30
4
167 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Suggested Solutions

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
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…

713 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