In the C language, using keyboard interrupt, how can I display an alternate key from what the user typed? E.g., when I press 'Q' on the keyboard, then the screen should display 'A'.
Asked
Active
Viewed 2,163 times
1
-
Ugh, because it was marked as community wiki and I'm the one who edited it to be coherent, it now looks like I was the one who asked the question. That's kinda icky... – Domenic Nov 02 '08 at 14:06
-
You should probably comment on the environment that you are working in. Mac? XP? Linux? What compiler are you using? What are you going to be using this for? Supplying a better context is likely to generate better answers. – EvilTeach Nov 02 '08 at 14:06
2 Answers
1
Handling keyboard interrupt is not a good idea on any platform. What about usb keyboards, there is no interrupt you can catch ?
For Windows OS's you probably want to write filter driver, you can find this replay partly relevant.
Sample of keyboard filter driver can be found here.
For Linux you probably need to patch HID layer driver. Mac is out my scope completely :)
0
We need a little more information about Your environment.
As far as I understand Your question, You want to replace the keyboard interrupt handler with Your own in this way:
- Save the entry address of the original keyboard handler.
- Install Your own that calls the original and manipulates the keycode value.
However, on most modern operating systems it is much easier to define and install a new keyboard layout.

Black
- 5,022
- 2
- 22
- 37