WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Detect Keyboard Tricks

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Keyboard Remapping 2000/XP

Keywords:    Keyboard Remapping

We have users who do data entry. They prefer to have the "+" key on the numeric keypad act as a tab.

We had some programs that allowed this for Windows 95, but when they got windows 2000 machines the programs didn't work.

Here is a winbatch program I wrote so our support folks could easily create this mapping for them.

(The registry key it creates is new to 2000/XP, so this will not work on 9x machines.)


The layout of the Registry entry is found at:

http://www.microsoft.com/hwdev/tech/input/w2kscan-map.asp

The keyboard scan code docs can be downloaded from:
http://download.microsoft.com/download/whistler/hwdev3/1.0/WXP/EN-US/scancode.exe

;-----------------------------------------------------
;  Create or delete a regestry key to map the
;  Plus key on the numeric keypad to a tab.
;
;  Windows 2000/XP 
;-----------------------------------------------------
Ver = WinVersion(5)
Version1 = ItemExtract(1,Ver,"-")
Version2 = ItemExtract(2,Ver,"-")
if (Version1 < 2 || (Version1 == 2 && Version2 < 5))
     Message("Plus2Tab","Sorry. This only works for Windows 2000")
     return
endif

SubKey = "SYSTEM\CurrentControlSet\Control\Keyboard Layout[Scancode Map]"
Mapping = "00 00 00 00 00 00 00 00 02 00 00 00 0F 00 4E 00 00 00 00 00"

MyDialogFormat=`WWWDLGED,5.0`
MyDialogCaption=`Plus to Tab`
MyDialogX=68
MyDialogY=87
MyDialogWidth=122
MyDialogHeight=55
MyDialogNumControls=3
MyDialog01=`16,4,82,DEFAULT,PUSHBUTTON,DEFAULT,"Map Plus to Tab",11`
MyDialog02=`16,19,82,DEFAULT,PUSHBUTTON,DEFAULT,"Remove Keyboard Mappings",12`
MyDialog03=`16,34,82,DEFAULT,PUSHBUTTON,DEFAULT,"Cancel",13`
ButtonPushed=Dialog("MyDialog")

if ButtonPushed == 11 
    OK = RegSetBin(@REGMACHINE,SubKey,Mapping)
    If OK 
        Message("Success",StrCat("Keyboard mapping successful.",@CRLF,"Change will take effect after the next reboot."))
    Else
        Message("Failed","The Keyboard mapping failed.")
    endif
    return
endif

If ButtonPushed == 12 
    OK = RegDelValue(@REGMACHINE,SubKey)
    If OK 
        Message("Success",StrCat("Keyboard mapping removed.",@CRLF,"Change will take effect after the next reboot."))
    Else
        Message("Failed","Failed. Could not remove the mapping.")
    endif
    return
endif

Article ID:   W15290
File Created: 2002:09:05:13:51:04
Last Updated: 2002:09:05:13:51:04