Monday, August 01, 2011

How to Get the last system lock or unlock time using C#.Net?

Posted by Rahul Kharde at 3:03 AM
Hello Friends,

The following code shows you how to lock and unlock a folder. User can browse the specific folder to lock/Unlock it.

SystemEvents in using Microsoft.Win32 namespace Provides access to system event notifications.

static void Main(string[] args)
{
SystemEvents.SessionSwitch += new SessionSwitchEventHandler(SystemEvents_SessionSwitch);
Console.ReadLine();
}

static void SystemEvents_SessionSwitch(object sender, SessionSwitchEventArgs e)
{
if (e.Reason == SessionSwitchReason.SessionLock)
{
Console.WriteLine("lock");
}
else if (e.Reason == SessionSwitchReason.SessionUnlock)
{
Console.WriteLine("Unlock");
}
}


If you enjoyed this post and wish to be informed whenever a new post is published, then make sure you subscribe to my regular Email Updates. Subscribe Now!


Kindly Bookmark and Share it:

YOUR ADSENSE CODE GOES HERE

0 comments:

Have any question? Feel Free To Post Below:

 

Popular Posts

Recent Comments

© 2011. All Rights Reserved | Help to understand .Net | Template by Blogger Widgets

Home | About | Top