How Do I prevent User from Locking the System?
Obviously I can set following Windows registry value
But it doesn’t serve my propose
[HKEY_CURRENT_US ER\Software\Mic rosoft\Windows\ CurrentVersion\ Policies\System]
"DisableLockWor kstation"=dword :00000001
I need something as the code follows in here
Thank you
Obviously I can set following Windows registry value
But it doesn’t serve my propose
[HKEY_CURRENT_US ER\Software\Mic rosoft\Windows\ CurrentVersion\ Policies\System]
"DisableLockWor kstation"=dword :00000001
I need something as the code follows in here
Code:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
SystemEvents.SessionSwitch += new SessionSwitchEventHandler(SystemEvents_SessionSwitch);
}
void SystemEvents_SessionSwitch(object sender, SessionSwitchEventArgs e)
{
try
{
if (e.Reason == SessionSwitchReason.SessionLock)
{
if (MessageBox.Show("Are you sure you want to lock", "Confirm", MessageBoxButtons.YesNo) == DialogResult.No )
{
//?????
//Stop the User in here…
//?????
}
}
}
catch (Exception)
{
throw new NotImplementedException();
}
}
}
}
Thank you