tags:

views:

81

answers:

1

This is in regards to applications that run in the taskbar but should be applicable to standard apps, Winforms, WPF, etc.

Question: I am after some method (preferably via managed code) to be notified when a user either has their screen "locked" while my app is running and/or know when they log back in.

GMail Notifier does this sort of thing for example, if my PC is locked for a while when I log in again it shows a list of emails that arrived since locking the PC. I'm looking to replicate that kind of functionality.

Does anyone have any ideas on how to accomplish this?

A: 

You want to hook into the System Event Notification Service and subscribe to the ISensLogon DisplayLock/DisplayUnlock events.

Nick Bastin
Do you know of a good managed implementation using `ISensLogon`?
Paul Kohler
I don't know of an explicitly managed implementation, but there's an example implementation in Python at http://timgolden.me.uk/python/win32_how_do_i/track-session-events.html
Nick Bastin