I am doing an Online Quiz project in C#. The test client is a Windows Desktop Application running on Windows XP. I need to block the control+alt+delete key combination to prevent students from minimizing/closing the application.
Using PInvoke is okay for me.
I know this is definitely possible because I have seen three applications doing this. They are all proprietary, so I have no way of knowing how it was done.
Using the Keyboard: Press Ctrl, Alt and Del at the same time. Then, select Lock this computer from the options that appear on the screen.
Hit the Windows key and the L key on your keyboard. Keyboard shortcut for the lock!
I achieved a similar goal, but with a different tactic in a Time Tracker tool I whipped up. This will give you a form which takes over the screen - doesn't allow windows to appear on top of it and will shoot down task manager if it is started.
override the Form.OnLoad method like so:
protected override void OnLoad(EventArgs e)
{
base.OnLoad(e);
this.Location = SystemInformation.VirtualScreen.Location;
this.Size = SystemInformation.VirtualScreen.Size;
}
Create a timer, with a 500 millisecond interval, which looks for, and kills "taskmgr.exe" and "procexp.exe".
Override the Form.OnFormClosing:
protected override void OnFormClosing(FormClosingEventArgs e)
{
if (e.CloseReason == CloseReason.UserClosing || e.CloseReason == CloseReason.FormOwnerClosing)
{
MessageBox.Show("Nice try, but I don't think so...");
e.Cancel = true;
return;
}
base.OnFormClosing(e);
}
Override OnSizeChanged:
protected override void OnSizeChanged(EventArgs e) {
base.OnSizeChanged(e);
this.WindowState = FormWindowState.Normal;
this.Location = SystemInformation.VirtualScreen.Location;
this.Size = SystemInformation.VirtualScreen.Size;
this.BringToFront();
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With