I am using the C# language for developing the software.
How could I disable control-alt-delete buttons so that the user of the program could only use the dropdown menu's Exit option to quit the program?
Printable View
I am using the C# language for developing the software.
How could I disable control-alt-delete buttons so that the user of the program could only use the dropdown menu's Exit option to quit the program?
Start the taskmanager hidden.(can't kill a process) and if the key's hit again..it will stay hidden.
Then close it when the exam is done.
[DllImport("user32.dll")]
Code:public static extern int FindWindow(string lpClassName, string lpWindowName);
[DllImport("User32.dll")]
public static extern Int32 SendMessage(
int hWnd, // handle to destination window
int Msg, // message
int wParam, // first message parameter
int lParam); // second message parameter
private void Form1_Load(object sender, EventArgs e)
{
Process p = new Process();
p.StartInfo.WorkingDirectory = Environment.GetFolderPath(Environment.SpecialFolder.System);
p.StartInfo.FileName = "taskmgr.exe";
p.StartInfo.CreateNoWindow = true;
p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
p.Start();
}
private void Form1_FormClosing(object sender, FormClosingEventArgs e)
{
const int WM_CLOSE = 0x0010;
int taskManager = FindWindow("#32770", "Windows Task Manager");
SendMessage(taskManager, WM_CLOSE, 0, 0);
}
You can use this hint also,
whenever another window is opened (including the Task Manager), your window gets a Deactivate event. For instance:
private void MyForm_Deactivate (...)
{
Activate ();
BringToFront ();
Focus ();
}
This will already help keeping your window on top of most others.
Hi,
I had also confused with this thread but when i checked it out it works properly.
You can disable Ctrl-Alt-Del with the usual method with Win32 application,
but this is just the programming method to do this.
& this method is mentioned in msdn library.
:thumbup1: