Archive for the ‘Keyboard’ Category.

KeyToggleStart: Yet another usage for keyboard hook

Hello Windows Mobile Users

recently the following was requested:

How can I start an application by just hitting some keys in sequence?

The answer: Just use a keyboard hook.

So I started to code this hook tool based on my KeyToggleBoot2 code. There was not too much to change. The new tool is called KeyToggleStart and it is configured by the registry:

            REGEDIT4

            [HKEY_LOCAL_MACHINE\Software\Intermec\KeyToggleStart]
            "ForbiddenKeys"=hex:\
                  72 73 00
            ;max 10 keys!
            "KeySeq"="123"
            "Timeout"=dword:00000003
            "LEDid"=dword:00000001
            "Exe"="\\Windows\\iexplore.exe"
            "Arg"=""

Reg keys meaning:

Forbiddenkeys is just an addon feature: key codes entered in this list will not be processed any more by your Windows Mobile device. For example, to disable the use of the F3(VK_TTALK) and F4 (VK_TEND) keys you have to enter a binary list of 0x72,0x73,0x00 (the zero is needed to terminate the list).

KeySeq list the char sequence you want to use to start an application. For example if this is the string “123”, everytime you enter 123 in sequence within the given time, the application defined will be started.

TimeOut is the time in seconds you have to enter the sequence. So do not use a long key sequence as “starteiexplorenow” and a short timeout (except you are a very fast type writer). The timeout is started with the first char matching and ends after the time or when you enter a non-matching char of the sequence.

With LEDid you can specify a LED index number. LED’s on Windows Mobile are controlled by an index number, each LED has one or more ID assigned to it. So, with LEDid you can control, which LED will lit, when the matching process is running. You can even find an ID to control a vibration motor, if your Windows Mobile device is equipped with one.

The Exe registry string value is used to specify which application will be started when the key sequence is matched.

If the application you want have to be started needs some arguments, you can enter these using the Arg registry value.

When you start the KeyToggleStart tool, you will not see any window except for a notification symbol on your Start/Home screen of the device.

If you tap this icon (redirection sign) you have the chance to end the hook tool.

Continue reading ‘KeyToggleStart: Yet another usage for keyboard hook’ »

ITCKeyboard: a class to manage ITC keyboard mappings

Although Intermec provides a control panel and an API to remap keys for Intermec Mobile Computers these tools only support normal remappings. This means for example you can remap a hardware key to produce a virtual key code. But you cannot map a key to the other great possibilities of the keyboard driver:

  • switch the keyboard plane (shiftkey)
  • map as modifier key
  • map as rotate key (one that produce abc depending on how often you press is)
  • multikey that produces a sequence of key strokes
  • event key, one that fires a named event pair (like the scan button does)
  • a function key that executes a function inside a DLL

I also added classes to manage the used tables as for example MultiKeys, ShiftKeys, RotateKeys, ModifierKeys and so on.

As an example on how the the USB codes are layed out on a device. Unfortunately I only have mappings of this device and not for the others. Therefor you can only suggest the key to remap by the printing on the key.

There is no support in the Intermec tools to remap directKeys. For example the side buttons of a CN3 or CN4 or the PTT button of the CK3 are not managed via the usb keyboard driver, these are managed by a direct keyboard driver. ITCKEYBOARD enables you to remap this keys thru an API.

Continue reading ‘ITCKeyboard: a class to manage ITC keyboard mappings’ »

Mobile Development: another keyboard hooking tool: keyToggleCtrl

This is again a keyToggle application. An application that works in background using a keyboard hook.

After keyToggleCtrl has been started, it will install a keyboard hook and watches the keyboard messages for the appearance of the toggle, or as I call it, the sticky key.

When the sticky key is detected, keyToggle Ctrl will watch the keyboard messages for the keys listed in a keytable (default is watching for presses of the number keys 0 to 9). If the pressed key matches a key in the keytable, keytogglectrl will remove the message from the window message queue and instead send the key found in CharTable with Control pressed before and released after the replaced key.

For example, you press the sticky key, the LED defined by LedID should light and if you then press 0, keyToggleCtrl will send instead Control+C to the active application.

KeyTest3AK IMAGE

Continue reading ‘Mobile Development: another keyboard hooking tool: keyToggleCtrl’ »

keyToggleChar – a tool to enter UTF-8 national chars via keyboard

As you may know my keyToggle app to be able to use the number keys on a windows mobile device as function keys, here is another one that enables you to enter special national chars, like Å, Ä Æ etc. directly via the keyboard. You must specify 10 keys and there UTF-8 replacements. Configuration is done via the registry:

3.0        added code for read/write reg for CharTable and KeyTable
 REGEDIT4

 [HKEY_LOCAL_MACHINE\Software\Intermec\KeyToggleChar]
 "KeyTable"=hex:\
 30,31,32,33,34,35,36,37,38,39
 "CharTable"=hex:\
 C6,00,E6,00,D8,00,F8,00,C5,00,E5,00,C2,00,E2,00,C4,00,E4,00
 "LEDid"=dword:00000001
 "autoFallback"=dword:00000000
 "Timeout"=dword:00000003
 "StickyKey"=dword:00000074

 KeyTable     holds a list of 10 keys which will be 'remapped'
 CharTable    holds  list of UniChar codes to use as replacement
 LEDid        defines the ID of the LED to use for showing sticky state
 autoFallback defines, if the sticky state is reset after a mapped key is pressed.
              Use 0, if you dont want the sticky state to fallback after keypress
 TimeOut      defines a timout after which sticky state will be reset

To get the UTF-8 word entries for Unicode chars, see for example here: http://www.unicode.org/charts/charindex.html

The default mapping used here is defined as follows and maps the keys 0-9 to:

0x00c6, 0x00e6, 0x00d8, 0x00f8, 0x00C5, 0x00e5, 0x00c2, 0x00e2, 0x00c4, 0x00e4
 AE        ae     O/       o/      A°      a°      A^      a^      Ä       ä

The main problem I had was finding a function to get the window handle of the current input active window. Finally I found GetForegroundKeyboardTarget() (after some days of searching).

Continue reading ‘keyToggleChar – a tool to enter UTF-8 national chars via keyboard’ »