How to find out if a win32 C ++ application has lost after CTRL-ALT-DEL?

I wrote win32 App in C++ (game), and I want to know if the application lost focus due to the user pressing CTRL - ALT - DEL and starting with the task manager . How can i do this? What I want to do after detecting an event is to minimize the window of my game and pause its processing (animations, audio, etc.). However, if the user returns from the CTRL - ALT - DEL menu to the game, he should continue to work as usual. I thought that I can test the keystrokes on CTRL , ALT and DEL , but this does not seem to work, and just reacting to the lost the focus ( WM_KILLFOCUS ) is not what I want.

+5
source share
1 answer

You can use WTSRegisterSessionNotification () , you will receive the WM_WTSSESSION_CHANGE message when the user press Ctrl + Alt + Del and switches to the secure desktop.

Remember that you can’t say that it was actually a secure desktop that he switched to, that would be a pretty nasty security leak. You will also receive a notification when it switches to another login session. Also the case when you want, of course, to stop the game.

In this case, the game should automatically pause whenever the game window loses foreground. Nobody likes to be killed when they switch to their mailbox :) Use the WM_ACTIVATEAPP message

+5
source

All Articles