A Windows application that adds customizable prefix and suffix text to keyboard input from a selected keyboard device. Perfect for multi-keyboard setups, barcode scanners, or any scenario where you need to automatically wrap input from a specific keyboard with predefined text.
- Selective Keyboard Hooking: Choose which keyboard device to monitor from a list of connected keyboards
- Prefix & Suffix Text: Automatically add custom text before and after input from the selected keyboard
- Low-Level Input Control: Uses the Interception driver for reliable, system-wide keyboard hooking
- ImGui Interface: Clean, responsive GUI built with ImGui and DirectX 11
- System Tray Integration: Minimize to tray, start/stop hooking, and quick access to controls
- Run on Startup: Optional Windows Task Scheduler integration to launch on system boot
- Device Persistence: Remembers your selected keyboard by VID/PID across sessions
- Configurable Timing: Adjust idle timeout and timer tick intervals for optimal performance
- DPI Aware: Crisp rendering on high-DPI displays
- Barcode Scanner Integration: Automatically format barcode scanner input with prefixes/suffixes
- Multi-Keyboard Workflows: Differentiate input from multiple keyboards for data entry tasks
- Automated Data Entry: Add formatting or delimiters to specific keyboard input
- Testing & Development: Simulate formatted input for application testing
And it appears as a tray app.
- OS: Windows 10/11 (64-bit)
- Privileges: Administrator rights (required for Interception driver)
- Dependencies: Interception driver (included in installer)
- Download the latest
keyPrefix_Setup.exefrom the Releases page - Run the installer as Administrator
- The installer will:
- Install the application to
Program Files\keyPrefix - Install the Interception driver
- Create Start Menu shortcuts
- Optionally create a desktop icon
- Install the application to
- Important: The installer requires a system restart to load the driver
- CMake 3.20 or higher
- Visual Studio 2019 or newer (with C++ desktop development workload)
- Dear ImGui library
- Interception driver SDK
-
Clone the repository:
git clone https://github.com/Amrkurdi202/keyPrefix.git cd keyPrefix -
Download Dear ImGui and extract it to
C:\dev\imgui(or updateCMakeLists.txtwith your path) -
Configure and build:
mkdir build cd build cmake -DCMAKE_BUILD_TYPE=Release .. cmake --build . --config Release
-
The executable will be in
build\Release\keyPrefix.exe -
Install the Interception driver manually:
installer\dependencies\install-interception.exe /install
- Run
keyPrefix.exeas Administrator (required for driver access) - The main window displays a list of detected keyboards
- Select your target keyboard from the list (e.g., a barcode scanner)
- Configure prefix and suffix text in the text boxes
- Enable "Hook enabled" to start monitoring
- Hook enabled: Enable/disable keyboard monitoring
- Idle timeout ms: Time to wait for inactivity before processing input (10-2000ms)
- Timer tick ms: Polling interval for the hook thread (1-50ms)
- Run on startup: Creates a Windows Task Scheduler task to auto-start minimized
- Prefix/Suffix: Multi-line text fields supporting Unicode input
Right-click the tray icon for quick actions:
- Show/Hide main window
- Start/Stop hook
- Exit application
/minimized- Start the application minimized to tray
Example:
keyPrefix.exe /minimizedSettings are saved to %LOCALAPPDATA%\keyPrefix\config.txt including:
- Selected keyboard VID/PID
- Prefix and suffix text
- Timing parameters
- Hook enable state
- Interception Driver: Installs a kernel-mode driver that intercepts keyboard input at the lowest level
- Device Selection: Enumerates connected keyboards by hardware ID and allows selection
- Input Monitoring: Hooks keyboard events from the selected device only
- Text Injection: When input is detected:
- Sends prefix text (if configured)
- Allows original input to pass through
- Sends suffix text (if configured)
- Idle Detection: Uses configurable timeout to determine when input sequence is complete
keyPrefix/
├── main.cpp # Application entry point and main loop
├── app_logic.cpp/h # Core application logic and hook thread
├── interception_logic.cpp/h # Interception driver interface and key sending
├── config.cpp/h # Configuration file management
├── window_manager.cpp/h # Window creation and message handling
├── directx_renderer.cpp/h # DirectX 11 rendering setup
├── imgui_helpers.cpp/h # ImGui utility functions
├── startup_manager.cpp/h # Windows Task Scheduler integration
├── string_utils.cpp/h # UTF-8/UTF-16 string conversion
├── globals.cpp/h # Global state and shared variables
├── keyboard_info.h # Keyboard device info structures
├── interception.c/h # Interception driver API
├── resource.rc/h # Application icon and resources
├── CMakeLists.txt # Build configuration
└── installer/
├── installer.iss # Inno Setup installer script
└── dependencies/
└── install-interception.exe # Interception driver installer
- Install Inno Setup
- Build the Release version of keyPrefix
- Open
installer\installer.issin Inno Setup - Click "Compile" to generate
installer\Output\keyPrefix_Setup.exe
- Ensure you've restarted your computer after installation
- Check that the Interception driver is installed: Run
install-interception.exe /installas Administrator - Verify the service is running:
sc query keyboardin Command Prompt
- Try unplugging and replugging the keyboard
- Check Device Manager for any driver issues
- Some USB keyboards may need a USB hub to be properly detected
- Run as Administrator
- Check Windows Event Viewer for error messages
- Ensure DirectX 11 is available on your system
- Make sure "Hook enabled" is checked
- Verify you've selected a keyboard from the list
- Try adjusting the idle timeout value
- Check that no other keyboard hook software is running
- Open "Add or Remove Programs" in Windows Settings
- Find "keyPrefix" and click Uninstall
- The uninstaller will automatically remove the Interception driver
- Restart your computer to complete driver removal
- This application requires Administrator privileges due to the kernel-mode Interception driver
- It only monitors the selected keyboard device, not all input
- No data is transmitted over the network
- Configuration is stored locally only
- The Interception driver is open-source and widely used in the community
This project is released under the Unlicense - it is completely free and open for any use, commercial or non-commercial, with no restrictions whatsoever. You can do anything you want with this code.
This project uses the following components:
- Interception: Interception Driver (Non-commercial use) - Low-level keyboard input driver
- Dear ImGui: MIT License
- Project Code: Unlicense (Public Domain)
Contributions are welcome! Please feel free to submit issues or pull requests.
- Follow the "Building from Source" instructions
- Open the project in CLion or Visual Studio
- Make your changes
- Test thoroughly with different keyboard configurations
- Submit a pull request
- Interception by Francisco Lopes - Low-level input driver used for keyboard hooking
- Dear ImGui by Omar Cornut
- DirectX 11 rendering implementation
- Enhanced keyboard device selection
- Improved prefix/suffix text handling
- Configurable timing parameters
- System tray integration
- Startup task support
- DPI awareness improvements
For issues, questions, or feature requests, please open an issue on the GitHub Issues page.
Note: This software is provided as-is. The Interception driver requires administrator privileges and operates at the kernel level. Use at your own risk.


