Last active
November 8, 2018 01:58
-
-
Save agentzex/328e993cc38f6818ac80f7deca7c6274 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
BOOL WINAPI HandlerRoutine(DWORD signalType) | |
{ | |
switch (signalType) | |
{ | |
case CTRL_LOGOFF_EVENT: | |
//Enter your code to be performed right before log-off here | |
RegisterForStartup(); | |
return TRUE; | |
case CTRL_SHUTDOWN_EVENT: | |
//Enter your code to be performed right before shutdown here | |
RegisterForStartup(); | |
return TRUE; | |
default: | |
return FALSE; | |
} | |
} | |
SetConsoleCtrlHandler(HandlerRoutine, TRUE); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment