Friday, June 17, 2011

.NET WinForms - How to listen to events for system LogOff, User Locked, Hibernate Started and System resumed?

Question:
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?

Ans:

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/

No comments:

Post a Comment