Does anyone know, programmatically, how to disable, then reenable, the keyboard? I know how to do that with the mouse, but I have an app for which I need to be able to disable and reenable both.
There is no GOOD reason to disable the KEYBOARD! There are several UNDOCUMENTED ways to do so. If you want to intercept key-strokes, that one thing. But disable the KEYBOARD?, I don't think so. Sounds like your trying to hatch a VIRUS to me!!!! If not, then please be more specific in what you are trying to do. Tim
Remember the KISS principle:
Keep It Simple, Stupid!
I agree that there is no GOOD reason for disabling the keyboard. It wasn't my idea. It was a management requirement. Do I need to say more? I have a program which I put into production shortly after I submitted this post. This program runs in a kiosk. Actually, it runs in 5 different kiosks, one on each floor of the building that I'm in. Management decided that they wanted both the mouse and keyboard disabled so someone couldn't walk on by and just shut the thing down.
This post was actually a consession to them. I promised I'd try to find out how to do it.
Umm....... Lock up the mouse & KB inside the kiosk.?
if the KB was disabled, how would a legitimate KB user(programmer, manager, salesperson etc.) be able to use it? Tim
Remember the KISS principle:
Keep It Simple, Stupid!
The only ones requiring access to it is the programmer (me), and I have the source code. At the moment, all it does it scroll information regarding company direction, HR stuff, and things like that. It is for viewing only. I'd never say this to the folks around here, but the whole way they had me set this up is dumb, and I don't think anyone is going to find it very useful. But...I'm just your humble programmer following his specs... (Actually, the keyboard really isn't locked, but no one knows that. I built in a key combination that will "unlock" it. I had to. The way updates were supposed to be performed was to physically power off the machine which is a really dumb idea.)
If you really dont want any1 going into that system, do a password lock with the screensaver. Your program should still be functioning in the background.
Your situation sounds terrible. If managements wants to protect the software so that no one touches it, they should really re-think their idea. Software lock isn't the answer b/c if I really wanted to mess with that computer, I still can. There's so many other ways to do it...power button for example.
When making the form take up the whole screen and disabling the form, can't I still Ctrl-Alt-Del and shut it down? I guess it would depend on the technical level of the individuals around your area. I dont think this idea would stop members of this forum from killing a program like that since we are all technical users.
I don't know, the whole thing seems like they should just build a seperate room for the computer running the program, complete with A/C, and 440 volts power, run REALLY long VGA cables through a splitter, to each freakin monitor so that there is no mouse, keyboard, computer, near the monitor because it's all locked up in a seperate room with steel-reinforced concrete and laser beams that poke you in the eye with nerf darts if you are an intruder... Then it'll drop green goop all over you. Management should buy that.
Oh... and the floor should be surrounded by land mines. Or is this too much?
You can hide your application from the CTRL-ALT-DEL list, so thats not really a problem and since there is a keyboard lock, how on earth would someone be able to press CTRL-ALT-DEL... If they reboot (which seems unlikely, because the towers are most of the times covered behind locks), the application will load again if you simply add a registry key.
Anyway, I think you should make a system wide hook in C++ and return -1 for a keypress or mousepress. If you do that, there wont be any keyevents or mouseevents at all and you can still process the events.
You can easily disable the keyboard with:
[tt]Shell "rundll32 keyboard,disable"[/tt]
Re-enabling it isn't so simple LOL.
LuckyLuke may have a workable idea (if you feel up to coding a C++ DLL). As long as you aren't worried about background processing, a simpler (not-so-efficient) way may be to use [tt]GetAsyncKeyState[/tt] in a fast timer and use [tt]SendKeys "^Z"[/tt] every time a new key is pressed.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.