Windows – Temporarily Disable Keyboard

keyboardwindows xp

There are times when I need to disable my keyboard for a while to avoid unnecessary keystrokes which are quite likely to happen, like we can disable touch-pad of most laptop then enable it again.

I was wondering if there is a tool for which provides the functionality the same functionality for keyboards for Windows XP SP2.

Best Answer

Yes, AutoIt can certainly do this. What do you need to trigger the on/off option? Do you only want to block the keyboard, or all types of input?

A simple example:

BlockInput(1) ;Disable all user input (mouse and keyboard)

Sleep(5000) ;sleep for 5 seconds

BlockInput(0) ;enable all user input (mouse and keyboard)

Or more complex, but probably more to what you are looking to do:

HotKeySet("d", "DoNothing") ;sets d key to function DoNothing
HotKeySet("{ESC}", "Terminate") ;sets ESC key to function Terminate

While 1 ;while loop to keep processor from maxing out
    Sleep(100)
WEnd

Func DoNothing() ;does nothing when d key is pressed

EndFunc

Func Terminate() ;exits out when ESC key is pressed
    Exit 0
EndFunc

In reference to the above, you will need to do a hotkey for every key you want to do nothing and just set it to the function DoNothing.