Is there anything I can do with my program wherein I have to do something when my application has been terminated using task manager?
I hope you can help me in this matter.
Thank you!
Is there anything I can do with my program wherein I have to do something when my application has been terminated using task manager?
I hope you can help me in this matter.
Thank you!
You can´t do this because the applications process is forcefully closed (killed). Events only happen if the application is asked to end e.g. call Close() or Exit().
If you need to do something when this happens implement a different app that monitors your app to take actions e.g. restart app or close another app.
I have a windows application that shells an outside application (.exe). What i want to achieve, is when the user terminates my windows application thru task manager, the shelled outside application should also be terminated.
As pointed out by others, you simply cannot do this, because when a process is killed, it receives no events at all. What you can do, however, if this requirement is super important, that you deploy a second program, which is a windows service, that monitors your windows app and shuts down the shelled application whenever it finds that your app is not running any more.