Tip

Remapping keys in Windows 2000 and XP

Windows 2000, XP and 2003 Server have the ability to remap incoming keystrokes through a registry entry. "Remapping" keystrokes means to reassign what key refers to what character or function, allowing (for instance) the left Shift key to be treated as the left Ctrl key.

Windows interprets keystrokes through keyboard scan codes. Each keypress sends a particular code to the keyboard controller in the computer, which is in turn passed on to Windows. When a user places key-remap entries in the registry for specific scan codes, they can be reinterpreted as another scan code, and thus be changed into another keystroke.

On some laptop keyboards, the presence of Alt or Shift keys next to other commonly-used keys can be distracting and problematic for some users who keep hitting the Shift key by mistake. With key remapping, the Shift key could be remapped to represent nothing at all to keep it from interfering with user input.

Aside from user comfort, some of the other possible applications for this is to hard-disable certain keys from ever being pressed (for kiosks or other applications), or to correct problems with firmware errors or aftermarket keyboards.

Scan code mappings are stored in the Registry under the key HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout, and are stored as sets of REG_BINARY keys. Once scan code mappings have been updated, they take effect after the current user logs off or after the system

    Requires Free Membership to View

is rebooted. Key mappings affect all users and cannot be changed on a user-by-user basis.

Editing them is not easy, unfortunately, since the scan codes are stored in a not-so-user-friendly way. To aid in creating and modifying keyboard scan codes, a number of third-party utilities have been written. One of the best and most useful is Sharpkeys 1.1, which can be used to interpret scan codes from any keyboard by simply pressing the keys. The resulting scan codes can then be saved to the registry (and then copied out of the registry and re-used on other machines if needed). The program requires the .NET framework to run.

If you want to learn how to edit your own key mappings, Microsoft has a document that describes the exact syntax for key mapping.


Serdar Yegulalp is the editor of the Windows 2000 Power Users Newsletter. Check out his Windows 2000 blog for his latest advice and musings on the world of Windows network administrators – please share your thoughts as well!


This was first published in May 2004

There are Comments. Add yours.

 
TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to:

Disclaimer: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.