Results 1 to 5 of 5

Thread: disable control-alt-delete using C#

  1. #1
    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?

  2. #2
    Join Date
    May 2008
    Posts
    2,389

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

  3. #3
    Join Date
    Feb 2008
    Posts
    1,852

    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.

  4. #4
    lucas999 Guest

    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

  5. #5
    Join Date
    May 2008
    Posts
    2,012

    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.


Similar Threads

  1. Replies: 7
    Last Post: 17-10-2011, 06:27 PM
  2. how to disable control panel
    By Agilent in forum Windows Security
    Replies: 3
    Last Post: 28-03-2011, 01:27 PM
  3. How to disable remote control with itunes
    By Deandre in forum Windows Software
    Replies: 6
    Last Post: 29-05-2010, 03:36 PM
  4. How to disable the User Account Control in vista
    By M. Rafi in forum Windows Software
    Replies: 4
    Last Post: 21-07-2009, 09:58 PM
  5. Partially disable UAC (User Account Control)
    By hayeden in forum Tips & Tweaks
    Replies: 1
    Last Post: 22-05-2009, 10:33 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,710,822,337.89770 seconds with 17 queries