Disable CTRL/DELETE and other keys in WinNT 4 (SP3 and above)
There are many situations when it's need to disable some combinations of keys from a VB program. For instance, ALT-TAB, CTRL-ESC, ALT-ESC or others like these. Other combinations could be tested at form level using KeyPreview property and KeyPress / KeyDown / KeyUp events. All system keystrokes won't fire key events in a form (or other controls) because they are handled internally by the system. Since application threads never receive messages for these keystrokes, there is no way that an application can intercept them and prevent the normal processing. This behavior is "by design" and ensures that a user can always switch to another application.s window even if an application.s thread enters an infinite loop or hangs.
The question is how we can intercept this keystrokes? The solution could be achieved using hooks. A hook is a point in the Microsoft Windows message-handling mechanism where an application can install a subroutine to monitor the message traffic in the system and process certain types of messages before they reach the target window procedure.
For Windows NT SP3 (or higher), Microsoft introduced a new hook: WH_KEYBOARD_LL. This hook is called the low-level hook because it is notified of keystrokes just after the user enters them and before the system gets a chance to process them. This hook has a serious drawback: the thread processing the hook filter function could enter an infinite loop or hang. If this happens, then the system will no longer process keystrokes properly and the user will become incredibly frustrated. To alleviate this situation, Microsoft places a time limit on low-level hooks. When the system sends a notification to a low-level keyboard hook.s filter function, the system allows that function a fixed amount of time to execute. If the function does not return in the allotted time, the system ignores the hook filter function and processes the keystroke normally. The amount of time allowed (in milliseconds) is set via the LowLevelHooksTimeout value under the following registry subkey: HKEY_CURRENT_USER\Control Panel\Desktop.
The program (VB) is disabling some of these combinations (ALT-TAB, CTRL-ESC and ALT-ESC) as long as the option is checked.

Comments
disable ctrl+alt+del
Posted by Legacy on 12/16/2003 12:00amOriginally posted by: adam
-
Replydisable ctrl+alt+del
Posted by DEX348 on 04/03/2004 05:00pmKeyboardControl SDK does the trick http://www.meliorasoft.com/kits/keyboard/
ReplyWindows Key 2 (Vb.Net Version)?
Posted by Legacy on 11/22/2003 12:00amOriginally posted by: Myr_Enforcer
is it possible to disable the windows key in vb.net? How? pls help...
-
Replyhi
Posted by sniperald on 04/11/2005 04:05amgood
ReplyWhat the?!?!
Posted by Legacy on 11/05/2003 12:00amOriginally posted by: Me
I used some cut and paste action into one of my games (where alt and tab were both weapons firing commands) buuuut it works when its not running but doesn't when it is running...
What the?
Replythats how to disable ctrl+alt+del on win NT & XP
Posted by Legacy on 07/25/2003 12:00amOriginally posted by: JoK
make a sub procedure like
timer1_timer()
on error resume next
kill sysdir & "\taskmgr.exe"
end sub
(Here timer1 should have the interval between events from 50 to 200 miliseconds)
------------- or ----------------------------------------
do while not stop
on error resume next
kill sysdir & "\taskmgr.exe"
loop
(Here stop should be a boolean variable set to true, all
Replyother things the program should do have to be in put between the do ... loop cicle and should not last long if you don't wanna ghive a chance to the user because the taskmanager application will be created ever and ever, 1-2 seconds after it was deleted.)
!!! In both cases you should put the <On Error Resume Next> and the sysdir should be the retrieved value
from getsystemdir API function!!!
none
Posted by Legacy on 07/25/2003 12:00amOriginally posted by: JoK
Astia-s cam tampiti, tu le vinzi un pont mura-n gura si ei te-ntreba cate varfuri are cuiul. Nashpa zau daca nu. Apropo eu is din Arad tu de pe unde esti?
ReplyASCII value for DELETE key ???
Posted by Legacy on 07/15/2003 12:00amOriginally posted by: raj
What is the ASCII value for DELETE key ????
ReplyDisable Taskmanager with Regedit
Posted by Legacy on 06/15/2003 12:00amOriginally posted by: me
Replydiable ctrl+alt+del
Posted by Legacy on 04/25/2003 12:00amOriginally posted by: jai
how to disable ctrl+alt+del through vb in registry?
-
Replylink
Posted by DEX348 on 07/31/2005 12:06pmhttp://www.meliorasoft.com/kits/
ReplyYou ROCK!!!
Posted by Legacy on 04/08/2003 12:00amOriginally posted by: CODE MASTER
You ROCK!!!
Reply
how to disable hotkey in IE6
Posted by Legacy on 03/20/2003 12:00amOriginally posted by: Marcus
how to disable hotkey in IE6 / Windows (ctrl-N = New, ctrl-S = Save, etc)
ReplyI want to know to protect my screen.
Loading, Please Wait ...