Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / Languages / C#

Mobile Development: Hooking the keyboard – KeyToggle

0.00/5 (No votes)
15 Jul 2010CPOL2 min read 8K  
Using keyboard hook to remap keys to function keys on windows mobile.

KeyToggle

Extend your keyboard to get function keys by pressing numbers.

With keytoggle you can define a ‘sticky’ key that will change the beahviour of the number keys. As long as the sticky key is ‘active’, number keys from 1 to 0 will produce the function keys F1 to F10. If sticky key is active, the left LED will light in green.

To start keytoggle just tap it or let it start by a link in StartUp. If keytoggle is loaded, you can see a small yellow arrow sign in the taskbar.

If you tap this symbol, you are asked, if you want to unload the app. If the registry does not have values defined for keytoggle, it will use default values. If you try to launch keytoggle a second time you will get a message box. Only one instance of keytoggle can run at a time.

Using the registry you can define the behaviour of the sticky key. In example, you can have the sticky key remain active until it is pressed again, let it ‘go off’ or ‘fallback’ after a period of time or let it fallback after a number key has been pressed. If the sticky key is pressed again, it will always fallback.

REGEDIT4
[HKEYLOCALMACHINE\SOFTWARE\Intermec\KeyToggle]
“Timeout”=dword:00000000
“autoFallback”=dword:00000001
“StickyKey”=dword:00000090

The values:

StickyKey:
default "144", decimal (VK_NUMLOCK)
the VK_ value of the sticky key. Here you define, what you will have as the sticky key.
VK_ values are defined as in winuser.h. In example the VK_ value for the
NumLock key is 0x90 (144 decimal, see VK_NUMLOCK). The sticky key will be
consumed by keytoggle and is not visible to the system any more. That means,
that you should choose key value that you do not need in any app you use.

Timeout:
default "3", three seconds
number of seconds the sticky key will remain active. If 0, the sticky key will
not fallback automatically by time

autoFallback:
default "0"
if 0 the sticky key will not fallback after pressing a number key. If 1 the sticky
key will fallback after a number key is pressed

Launch arguments

Keytoggle only supports one argument: "-writereg". This will create the
registry keys used by keytoggle and fill them with the default values.

Usage Sample Scenario

You have a ITC Color device with a numeric keyboard but no function keys. You need the function keys to be able to use a web application within iBrowse. With keytoggle you can now for example use the Gold key as sticky key. You have to download the device reource kit to get a keyboard remapper tool from the ITC site and assign the Gold key to NUMLOCK.

With this remapping and keytoggle running you will to get a function keystroke simulated if you press the Gold key and then a number key.

Download installer: DOWNLOAD:KeyToggle Installer CAB - (Hits: 1, size: 5.19 kB)

License

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