https://github.com/lontivero/open.winkeyboardhook
A simple and easy-to-use .NET managed wrapper for Low Level Keyboard hooking.
https://github.com/lontivero/open.winkeyboardhook
c-sharp hooking keyboard keyboard-events keyboard-shortcut windows
Last synced: 8 months ago
JSON representation
A simple and easy-to-use .NET managed wrapper for Low Level Keyboard hooking.
- Host: GitHub
- URL: https://github.com/lontivero/open.winkeyboardhook
- Owner: lontivero
- License: mit
- Created: 2014-05-10T02:02:47.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2019-01-09T10:08:56.000Z (over 7 years ago)
- Last Synced: 2025-02-01T19:02:52.398Z (over 1 year ago)
- Topics: c-sharp, hooking, keyboard, keyboard-events, keyboard-shortcut, windows
- Language: C#
- Homepage:
- Size: 15.6 KB
- Stars: 21
- Watchers: 5
- Forks: 10
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://ci.appveyor.com/project/lontivero/open-winkeyboardhook) [](http://badge.fury.io/nu/Open.WinKeyboardHook)
Open.WinKeyboardHook
====================
A simple and easy-to-use .NET managed wrapper for Low Level Keyboard hooking.
Goals
-----
The main goal is to abstract away the complexities inherit to intercept and translate global keystrokes (KeyDown / KeyUp / KeyPress) in the system.
Usage
-----
```c#
public partial class TestForm : Form
{
private readonly IKeyboardInterceptor _interceptor;
public TestForm()
{
InitializeComponent();
// Everytime a key is press we want to display it in a TextBox
_interceptor = new KeyboardInterceptor();
_interceptor.KeyPress += (sender, args) => txt.Text += args.KeyChar;
}
// Start and Stop capturing keystroks
private void BtnClick(object sender, EventArgs e)
{
if(!_capturing)
{
_interceptor.StartCapturing();
btn.Text = "Stop";
btn.BackColor = Color.Red;
}
else
{
_interceptor.StopCapturing();
btn.Text = "Start";
btn.BackColor = Color.Lime;
}
_capturing = !_capturing;
}
}
```
Real world example
------------------
Open.WinKeyboardHook is been used as the key component in [KeyPadawan](https://github.com/lontivero/KeyPadawan) project, a useful tool for presentation and screencasts that allow to display the shortcuts that a presenter uses.
Development
-----------
Open.WinKeyboardHook is been developed by [Lucas Ontivero](http://geeks.ms/blogs/lontivero) ([@lontivero](http://twitter.com/lontivero)). You are welcome to contribute code. You can send code both as a patch or a GitHub pull request.