steam3d / KeyCap

A Windows application for remapping keyboard input.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

KeyCap

Download the Latest Release

Updates in progress

Docs/code are being updated to v2 branch (just merged into master for further refinement/release).

Description

Windows only application for capture keyboard input and remapping it to:

  • another key or sequence of keys
  • mouse input
  • nothing at all
  • on/off toggles for keys and inputs (this allows a single keystroke to initiate a hold and a second keystroke to end the hold)
  • Repetition (with custom delay)

Example Uses

  • (original inspiration) Shortcutting a sequence of shortcuts. I originally created the application long ago to help with a sequence of keyboard shortcuts necessary to perform file merges when integrating a branch with Perforce + Araxis Merge
  • Starbound Keyboard shortcuts to toggle off/on mouse buttons. This makes extensive mining in the game a lot less painful. Mass Effect 2 planet scanning also can be a lot easier...
  • Dreamfall Chapters has a run button though it can be nice to have a button that toggles whether you are running or not instead of holding one down.
  • Citadel: Forged With Fire has a number of long mouse hold actions. Toggling this off/on instead of holding the button for long periods of time is extremely nice.

Run on Startup

With Registry Editor, add a new StringValue to HKCU\Software\Microsoft\Windows\CurrentVersion\Run with the full path to KeyCap.exe followed by the full path to your .kfg file. KeyCap will load the config file, start it and then minimize to the tray.

Alternatively, copy the following to a text file named KeyCap.reg and then edit it to match your setup. Save it, right click-it and selct Merge. Follow the prompts and then the next time you reboot, KeyCap will start automatically.

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run]
"KeyCap"="D:\\Util\\KeyCap\\KeyCap.exe D:\\Util\\KeyCap\\Config.kfg"

TODO:

  • Fix bugs!

Warning

This program does perform keyboard capture and is essentially the first component of a key logger. I humbly request you NOT use the information included in the source code to create a malicious application.

Visual Studio Notes

  • If you attempt to run from Visual Studio you will need to make sure the C# project is configured with Enable Native Code Debugging. If this is not enabled the dll will not create the necessary keyboard hook (works fine outside of Visual Studio). This was observed in every Visual Studio version up-to and including 2015.

Technical Documentation

.kfg File Format

The file is prefixed with two 32-bit ints:

File Data Prefix File Format Version
0x0E0CA000 0x1

The remainder of the file is a repeated sequence of the following information. One input may be associated with numerous outputs. Byte array representation of each input/output(s) pair:

Flags VirtualKey Parameter Outputs Count Output Flags Output VirtualKey Output Parameter (repeats for all outputs) ...

There is no count for the number of inputs. Instead the file is read until no further input/output(s) pairings can be read.

Flags

The flags indicate information that modifies the value (alt/shift/ctrl and special functionality when mapping to another output)

VirtualKey

A VirtualKey value.

Parameter

A special value associated with the input/output (as necessary based on the function).

Output Count

This is limited to a single byte despite the use of an int, so 255 maximum.

History

This is an old project I used many years ago for remapping input. I still find it useful sometimes.

Disclaimer

I am providing code in the repository to you under an open source license. Because this is my personal repository, the license you receive to my code is from me and not my employer.

About

A Windows application for remapping keyboard input.

License:MIT License


Languages

Language:C# 65.8%Language:C++ 23.0%Language:C 9.2%Language:Objective-C 2.0%