Keyboard Redirector / Programming / Keyboard Redirector

Description / Background

Keyboard Redirector is a windows based application that allows you to detect keystrokes from specific keyboard devices.

Click to read the background information ...


What does it do?

  • Uses the windows RawInput API to determine which keyboard a keystroke is from and allows you to block the keystroke from the focussed application
  • Can perform the following actions:
    • Send a Keystroke to the focused application
    • Start an application
  • Can perform different actions based on which application is in focus
    eg. assign the play key to press X in winamp, and Space in KMPlayer

What doesn't it do?

  • Due to the way the RawInput API works, it is not possible to intercept the keystrokes from applications that hook keyboard events (such as Girder, EventGhost, HIP, Media Center etc.).
    Using the Low Level option will intercept from these apps so long as Keyboard Redirector was started after them. The Low Level option is global and cannot determine which keyboard the keystroke is from.
  • Currently the only actions the application supports are executing an application and sending a keystroke. For the moment these are satisfactory for me to have my htpc working as I want.
    I may add more in the future but I think a better option is to integrate with another app like eventghost that already has lots of actions available.
Keyboard Redirector Zip File (382kb)   History
Keyboard Redirector Zip File (302kb)   History
Keyboard Redirector Zip File (299kb)   History
Keyboard Redirector Zip File (269kb)   History
Keyboard Redirector Zip File (268kb)   History

Source Code


Keyboard Redirector Forum thread

Use the forum to check for the latest updates, or to make any comments, suggestions, or bug reports.


Keyboard Redirector

  • Added a fix for loading in windows 10 where the device Class value no longer exists in the registry.
  • Updated projects and build process to use Visual Studio 2015 Community

Keyboard Redirector

Lots of changes to hopefully stop any lockups of the system
  • Added timeout of as much of WndProc as possible so that if something does go wrong it'll still return.
  • Added back code to delay sending action keystroke until the trigger keystroke is finished.
  • Improved the way KeyboardHook_KeyEvent waits for the Raw Input API to detect the keypress first.

Keyboard Redirector

  • A few updates for compatibility on different computers.
  • Added LWin and RWin to the modifiers list for Keyboard Actions.

Keyboard Redirector

  • Fixed up unhandled exception handling.
  • Added retry of reading registry information when a device is plugged in.
  • Removed DispatchMessage call that was causing a crash in XP 32bit.

Keyboard Redirector

  • First released version with source.
  • See svn log for details on all the changes up to this point.

Main Page.
Tip: Click in the "Type here to detect keys" box then press buttons on your keyboard/remote and they will be added to the list on the left hand side.

Setting Page.
Configure which devices send to your keyboard definitions on the left hand side. This is useful if you plug your device into a different usb port and it comes up a new device but you want it to be handled by the old keyboard definition you already set up.

Add/Edit Applications.
An application definition allows you to detect which app currently has the focus and perform different actions accordingly.

Add/Edit Actions.

Application Launcher

As a bonus, included with the Keyboard Redirector package is a program called ApplicationLauncher.

I designed this program to quickly and easily launch and switch between running application using my remote. In Keyboard Redirector I've mapped the MCE button on my remote to launch ApplicationLauncher.exe. Then using just Left, Right, Up, Down and Enter I can switch to any running application or launch one of the shortcuts I've defined. I can also use the number keys to launch the shortcuts directly.

Additionally, the shortcuts can be configured to switch to the application if it's already running instead of launching a new instance of the app. This means I can press MCE, then 9 on my remote and Winamp will be in focus regardless if it was already running or not.