How to get event when application is closed from task manager

I have developed a win32 application using c / c ++ that works on vista and xp,

I wanted to know if I can get any event in my application when my application is killed from

by selecting the "end process" button

I want to free some memory when my application exits.

Please help in this regard

with considering,

Vinayaka Karjigi

+2


source to share


2 answers


No, your application is terminated without any notice. You are at the mercy of the task manager.



+4


source


In .net 2.0, you can close the CloseReason.TaskManagerClosing reason . Therefore, I suspect that there is a structured exception that you must deal with.

Edit. Perhaps not



I suspect the CLR is putting a breakpoint in NTTerminateProcess for managed processes.

0


source







All Articles