views:

116

answers:

2

Hi All,

I have developed a win32 application using c/c++, which runs on vista and xp,

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

task manager, by selecting the "end process" button

I want to free some memory on exit of my application.

Please help in this regard

with regards,

Vinayaka Karjigi

+3  A: 

Nope, your application is terminated without any notice. You are at mercy of Task Manager.

sharptooth
And the OS will free the memory anyway so catching it to free memory is ENTIRELY pointless.
Goz
thanks for both of u for ur suggestions
Vinayaka Karjigi
A: 

In .net 2.0 you can get closing reason of CloseReason.TaskManagerClosing. Therefore I suspect there is a structured exception you should be able to handle.

Edit. Possibly not

I suspect that the CLR places break point on NTTerminateProcess for managed processes.

Preet Sangha