Is there any method to disable logoff,lock and taskmanager in ctrl+alt+del in C#

前端 未结 4 1358
逝去的感伤
逝去的感伤 2020-12-19 23:49

On running my window application. if the user press ctrl+alt+del i need to disable these buttons..is there any method

4条回答
  •  离开以前
    2020-12-20 00:26

    I was having the same question. I had to not let the user having access to the Ctrl+Alt+Del functionality. I did find a workaround to disable them. I changed the keyboard mapping inside the registry. As removing the Ctrl-Alt-Del functionality can be dangerous, I just switch the Alt key by the ScrollLock key. To do so, you will need to add the following registry key (see this website for more explanation, you can find the keyboard scan code everywhere if you want to change the ScrollLock by another key but here a link):

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout
    
    Key Name: Scancode Map
    Type: Binary
    Value to enter: 
    00 00 00 00 
    00 00 00 00 
    03 00 00 00 => represent the number of keys you are modifying + 1 (for some reason, mapping to another key is not counting as 1)
    00 00 38 00 => Left-Alt key is 38 00 so here we give 00 00 (nothing) to the Left-Alt key. It will disable it.
    38 00 46 00 => ScrollLock key is 46 00 so here we give the Left-Alt key functionality to our ScrollLock key. ScrollLock will be Alt key now.
    00 00 38 E0 => Right-Alt key is 38 E0 so here we give 00 00 (nothing) to the Right-Alt key. It will disable it.
    00 00 00 00 => Terminator
    

    Hope it helps one of you! You will just need to register this key in your application but be aware that it will impact the entire system!

提交回复
热议问题