views:

170

answers:

1

I need to detect the closing of the security screen, this is the full screen that appears when a user presses Ctrl+Alt+Del under windows. In Xp my application receives an wm_paint message when this screen is closed but under windows 7, a message is not always received, maybe only 25% of the time.

I tried catching the the WM_WTSSESSION_CHANGE message instead but I only receive this message if the user log outs then logs back into their account.

Not sure on the behaviour in Vista as I have only tested this on XP and 7 so far.

+1  A: 

Did you call WTSRegisterSessionNotification() for the window/session to receive the subtypes (wParam) of WM_WTSSESSION_CHANGE (WTS_CONSOLE_CONNECT, WTS_CONSOLE_DISCONNECT, WTS_SESSION_LOCK, WTS_SESSION_UNLOCK)? A plain win32 example is at http://support.microsoft.com/kb/310153

It seems WTS_SESSION_UNLOCK should be what you're after.

Ryan
I should have clarified, the WM_WTSSESSION_CHANGE message is not receieved if the user hits ctrl alt del, then just clicks cancel on the security screen that pops up. If i lock then unlock the account, i successfully receive the message. I think the problem may be something to do with Aero looking at it.
YoungPony
If the user hits cancel, then the session is never actually locked so it makes sense that you wouldn't receive the WTS_SESSION_UNLOCK message. I don't know how you handle the 'cancel' scenario except for simple focus tracking in the application.
Ryan
Ok, it is definitely an Aero issue. Reading into it apparently no WM_ messages are sent in this scenario because the windows are rendered differently under aero. see http://social.msdn.microsoft.com/Forums/en-US/vcgeneral/thread/b2e8d0bc-ee1c-4f8d-bcec-f4481418098f
YoungPony