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
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
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:
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/