tags:

views:

1114

answers:

2

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'.

A: 

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
+1  A: 

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 :)

Ilya