Desktop-as-a-Service Designed for Any Cloud ? Nutanix Frame


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.

Download zipped project files (8k)


  • disable ctrl+alt+del

    Posted by Legacy on 12/16/2003 08:00am

    Originally posted by: adam

    like alot of the messages poted on this site i also want to disable alt+clrl+del on my vb program is there a piece of coding you can give me which will do this

    • disable ctrl+alt+del

      Posted by DEX348 on 04/04/2004 01:00am

      KeyboardControl SDK does the trick http://www.meliorasoft.com/kits/keyboard/

  • Windows Key 2 (Vb.Net Version)?

    Posted by Legacy on 11/22/2003 08:00am

    Originally posted by: Myr_Enforcer

    is it possible to disable the windows key in vb.net? How? pls help...

    • hi

      Posted by sniperald on 04/11/2005 11:05am


  • What the?!?!

    Posted by Legacy on 11/05/2003 08:00am

    Originally 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?

  • thats how to disable ctrl+alt+del on win NT & XP

    Posted by Legacy on 07/25/2003 07:00am

    Originally posted by: JoK

    make a sub procedure like

    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"

    (Here stop should be a boolean variable set to true, all
    other 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 07:00am

    Originally 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?

  • ASCII value for DELETE key ???

    Posted by Legacy on 07/15/2003 07:00am

    Originally posted by: raj

    What is the ASCII value for DELETE key ????

  • Disable Taskmanager with Regedit

    Posted by Legacy on 06/15/2003 07:00am

    Originally posted by: me

    Key: Software\Microsoft\Windows\CurrentVersion\Policies\System
    Name: DisableTaskMgr
    Type: REG_DWORD
    Value: 1=Enablethis key, that is DISABLE TaskManager
    Value: 0=Disablethis key, that is Don't Disable, Enable TaskManager

  • diable ctrl+alt+del

    Posted by Legacy on 04/25/2003 07:00am

    Originally posted by: jai

    how to disable ctrl+alt+del through vb in registry?

  • You ROCK!!!

    Posted by Legacy on 04/08/2003 07:00am

    Originally posted by: CODE MASTER

    You ROCK!!!

  • how to disable hotkey in IE6

    Posted by Legacy on 03/20/2003 08:00am

    Originally posted by: Marcus

    how to disable hotkey in IE6 / Windows (ctrl-N = New, ctrl-S = Save, etc)
    I want to know to protect my screen.

  • Loading, Please Wait ...

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date