How to do something before the process is killed in windows

My program should take some resources. I want him to free these resources before going out. Easy to reach when normally open output. However, what if the user opens the task manager in Windows and kills the excutable? In this case, my destructors will not suffer.

Does anyone know a good participant to solve this problem? (WITH#)

Many thanks,

+3
source share
3 answers

You cannot handle this scenario if the user kills the application severely. But you do not need to worry about resources. Windows will automatically release the resources received by your process when it is killed.

+4
source

, - . , . , , ( , ).

+2

. , , (), SIGTERM Windows NT.

PInkoke signal SIGINT, , ctrl + c.

, Windows , , , , , .

0

All Articles