Useful and clean .NET Standard library to monitor keyboard and mouse input on Windows.
Built with ❤︎ by Daniel Belz
To monitor mouse and keyboard input you need to attach to the OnInputReceived event handler:
private static void Main()
{
var inputProvider = new InputProvider();
inputProvider.InputReceived += OnInputReceived;
Console.ReadLine();
}
private void OnInputReceived(Input input)
{
Console.WriteLine($"Key: {input.Key} | State: {input.State}");
}
To monitor mouse input you need to attach to the OnMouseInputReceived event handler:
private static void Main()
{
var inputProvider = new InputProvider();
inputProvider.MouseInputReceived += OnMouseInputReceived;
Console.ReadLine();
}
private void OnMouseInputReceived(MouseInput input)
{
Console.WriteLine($"Key: {input.Key} | State: {input.State} | X: {input.X} | Y: {input.Y}");
}
To monitor keyboard input you need to attach to the OnKeyboardInputReceived event handler:
private static void Main()
{
var inputProvider = new InputProvider();
inputProvider.KeyboardInputReceived += OnKeyboardInputReceived;
Console.ReadLine();
}
private void OnKeyboardInputReceived(KeyboardInput input)
{
Console.WriteLine($"Key: {input.Key} | State: {input.State}");
}
Contributions are always welcome!
Just send me a pull request and I will look at it. If you have more changes please create a issue to discuss it first.
If you like my software, please consider supporting me with a little donation. Thank you for your support! You are great!
This project is licensed under the MIT License - see the LICENSE file for details