Click here to Skip to main content
15,510,483 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i want to disable the keyborad and mouse with one hot key (like ALT-D) and enable it back with another hot key(also like ALT-E)...please help
Philippe Mori 6-Sep-11 19:50pm    
Unplug them! Replug them when you need them again. Or easier... lock your desktop.

If you disable the keyboard and mouse, how do you expect to RE-enable with a keyboard key press or a mouse click?
Share this answer
CPallini 6-Sep-11 9:12am    
Emilio Garavaglia 6-Sep-11 9:32am    
Yet another chicken and egg problem ...
_Zorro_ 6-Sep-11 12:07pm    
Outstanding sense of logic there! ... :)

Do you know how notebooks manage to do this though? Is it by hardware or on the keyboard's or motherboard's driver maybe?
(C++/MFC solution but applicable to other toolkits )

(not tested, nor verified, just as a base for discussion)
You could override PreTranslateMessage (or something similar) and check the key-press and when user enters alt-d you log it (save a state boolean) and when the boolean is true, just skip all the key-press except alt-e...

For the mouse, there might be something to do about it, but I've got no clue.

IMO, it's a bad idea to block the keyboard and mouse.
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900