retry111898
asked on
disable the keyboard
how can I disable (and enable) the keyboard - totaly.
and I'm not talking about key detection or something
alike.
and I'm not talking about key detection or something
alike.
Retry, To accomplish this thru VB you should be able to place a line on the form object or a module which looks something like this, On keypress set keyascii = null or any the ascii code for the space bar, this will eliminate any keypresses, then you can modify this in code to turn the keyboard back on. If not you may try this.From a hardware side,Depending on the os the App is built for the process is different, for NT a registry key HKEYLOCALMACHINE\DEVICEMAP \KEYBOARD CLASS CAN BE REMOVED AND REPLACED FOR KEYBOARD MANIPULATION. Also on Win 95 an API call can be performed to accomplish this task.
ASKER
I need the API call with Full code.
The code below will disable/disable keyboard and mouse input for windows; not just for the current application. Don't forget to enable the input again after you are done, or you will have to restart the computer!
Declare Function GetDesktopWindow Lib "user32" () As Long
Declare Function EnableWindow Lib "user32" (ByVal hwnd As Long, ByVal fEnable As Long) As Long
Public Sub DisableKeyMouseInput()
Dim lDesktop_hWnd As Long
Dim lRet As Long
lDesktop_hWnd = GetDesktopWindow()
lRet = EnableWindow(lDesktop_hWnd , False)
End Sub
Public Sub EnableKeyMouseInput()
Dim lDesktop_hWnd As Long
Dim lRet As Long
lDesktop_hWnd = GetDesktopWindow()
lRet = EnableWindow(lDesktop_hWnd , True)
End Sub
Declare Function GetDesktopWindow Lib "user32" () As Long
Declare Function EnableWindow Lib "user32" (ByVal hwnd As Long, ByVal fEnable As Long) As Long
Public Sub DisableKeyMouseInput()
Dim lDesktop_hWnd As Long
Dim lRet As Long
lDesktop_hWnd = GetDesktopWindow()
lRet = EnableWindow(lDesktop_hWnd
End Sub
Public Sub EnableKeyMouseInput()
Dim lDesktop_hWnd As Long
Dim lRet As Long
lDesktop_hWnd = GetDesktopWindow()
lRet = EnableWindow(lDesktop_hWnd
End Sub
This code will disable the keyboard hotkeys (alt-tab, ctrl-alt-del, etc.)
Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA"(By Val uAction As Long, ByVal uParam As Long, ByVal lpvParam As Any, ByVal fuWinIni As Long) As Long
To Disable:
Call SystemParametersInfo(97, True, "1", 0)
To Enable:
Call SystemParametersInfo(97, False, "1", 0)
Declare Function SystemParametersInfo Lib "user32" Alias "SystemParametersInfoA"(By
To Disable:
Call SystemParametersInfo(97, True, "1", 0)
To Enable:
Call SystemParametersInfo(97, False, "1", 0)
How about cutting the cable??
lol, perfect , you can surly disable it
ASKER
funny......
What specifically is wrong with the answers you have recieved?
why do you need to disable the keyboard anyway??
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Define text1 control in the form1
a)in text1_keydown event set keycode = 0
b)in text1_keypress event set keyascii = o
c)in text1_lostfocus event write the follow sentence text1.setfocus