Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > Apps

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 05-23-2011, 08:09 AM
dinesh dinesh is offline
Senior Member
 
Join Date: Jun 2007
Location: India
Posts: 149
Default Doing some cleanup task when doing End Process from Task Manager

Hi All,

In my application I want to do some cleanup task at application end. How can I do this when I will terminate the Application from task manager?
Reply With Quote
  #2  
Old 06-07-2011, 01:52 PM
DarkByte DarkByte is offline
Junior Member
 
Join Date: May 2011
Posts: 10
Default

I don't think it's possible. Task Manager "kills" your process - your application will not receive any Windows messages regarding this.

On the other hand, it might be possible for you to check when the Task Manager window pops up and do your cleanup - of course, there's a chance that your process won't be killed - in which case the cleanup might not be necessary.
Reply With Quote
  #3  
Old 06-07-2011, 09:06 PM
Glenn1234 Glenn1234 is offline
Senior Member
 
Join Date: Aug 2009
Posts: 131
Default

Quote:
Originally Posted by dinesh View Post
Hi All,

In my application I want to do some cleanup task at application end. How can I do this when I will terminate the Application from task manager?
Depends on how. If it's from the Applications tab, you can use TForm.CloseQuery. This event fires upon normal termination of the form.

If it's from the Process menu then there's no way to do this. Terminating a process kills it at that moment and there's no way to stop it or hook it (enabling it is a massive security hole).

If you're worried about cleanup, check for your temp resources before you start your program up and clean them up if they exist before your program gets down to business.
Reply With Quote
  #4  
Old 06-15-2011, 02:03 PM
dinesh dinesh is offline
Senior Member
 
Join Date: Jun 2007
Location: India
Posts: 149
Default

Hi Thanks for reply,

I have also tried a lot by using Hook without success
So finally I have decided to use some resources which I am checking on my Application start and if I find some invalid lock I will free those.

Thanks
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 09:32 PM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.