Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



disable control-alt-delete using C#

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 07-01-2009
Member
 
Join Date: Dec 2008
Posts: 12
disable control-alt-delete using C#
  

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?

Reply With Quote
  #2  
Old 07-01-2009
Member
 
Join Date: May 2008
Posts: 2,382
Re: disable control-alt-delete using C#

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);

}
Reply With Quote
  #3  
Old 07-01-2009
Member
 
Join Date: Feb 2008
Posts: 1,845
Re: disable control-alt-delete using C#

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.
Reply With Quote
  #4  
Old 08-01-2009
lucas999
 
Posts: n/a
Re: disable control-alt-delete using C#

Quote:
Originally Posted by opaper View Post
Start the taskmanager hidden.(can't kill a process) and if the key's hit again..it will stay hidden.
It's complete Bullshit.
Ctrl-Alt-Del does't activate TaskMgr if the OS is configured to switch the desktop,
You can call TerminateProcess() with any proggie,
WM_CLOSE must not never be sent,
etc...
Simply disable Ctrl-Alt-Del with the usual method with Win32 api
Reply With Quote
  #5  
Old 08-01-2009
Member
 
Join Date: May 2008
Posts: 2,007
Re: disable control-alt-delete using C#

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.

Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "disable control-alt-delete using C#"
Thread Thread Starter Forum Replies Last Post
How to disable SLI when I cannot run Nvidia’s control panel? Rucika Monitor & Video Cards 7 17-10-2011 06:27 PM
how to disable control panel Agilent Windows Security 3 28-03-2011 01:27 PM
How to disable remote control with itunes Deandre Windows Software 6 29-05-2010 03:36 PM
How to disable the User Account Control in vista M. Rafi Windows Software 4 21-07-2009 09:58 PM
Partially disable UAC (User Account Control) hayeden Tips & Tweaks 1 22-05-2009 10:33 PM


All times are GMT +5.5. The time now is 04:20 AM.