views:

243

answers:

1

I want to listen to events in my windows forms .NET application for the following system wide events :

Log Off Lock Windows Hibernate Started Sleep Started System Resumed

Are these possible?

Thanks

+3  A: 

You need to look WMI (Windows media instrumentation). You would need to create event watchers for the above mentioned events.

http://msdn.microsoft.com/en-us/library/ms257340%28VS.80%29.aspx

Useful links:

http://stackoverflow.com/questions/984881/get-log-off-event-from-system

How to create a WMI Event Watcher for a user logoff event?

http://social.msdn.microsoft.com/Forums/en-US/netfxbcl/thread/0c1bded8-0cce-4260-bd28-4b4ffce0d27d

http://www.aspfree.com/c/a/VB.NET/WMI-Programming-with-Visual-BasicNET-Trapping-System-Events/1/

Aseem Gautam