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.

Andrew
  • 1,608
  • 16
  • 31
  • 1
    You're probably not getting a WM_PAINT message all the time on 7 because the DWM caches the bitmap image of your application window, even when it's not visible at all. It'll only send a WM_PAINT if the window image has changed or the DWM has discarded its copy of the window image. Vista probably behaves like 7 in this regard. – Chris Smith Mar 26 '12 at 17:07

1 Answers1

1

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
  • 7,835
  • 2
  • 29
  • 36
  • 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. – Andrew Jan 08 '10 at 14:10
  • 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 Jan 08 '10 at 14:15
  • 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 – Andrew Jan 08 '10 at 14:20