Jump to content

How do i properly shutdown my program when it gets killed


Recommended Posts

I want to perform several cleanup actions, in the case my program ends.

Those cleanup actions should also be performed, when my program gets killed by e.g. taskkill (called without the /F force parameter).

I know from other languages, that there is a possibility to react on the "shutdown" message - i just can't find how to do this with autoit.

I found the windows event WM_QUERYENDSESSION, but this only applies to the shutdown of the complete machine.

Anybody any idea which Windows Event i have to register my program so that i can react on the "kill" of my program ?

Thanks in Advance,


Link to comment
Share on other sites

You could use a helper process that detects when the other process doesn't exists and then clean up the system.

sure i could do that, but then i would have to run two processes and i just do not like that idea.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...