Skip to content

kwerty/DviZe.Win.Hooks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

DviZe.Win.Hooks

Low-latency keyboard and mouse hooks for .NET console and non-UI applications.

⚡ Keyboard and mouse events are processed natively, only crossing the native-to-managed boundary for matching subscriptions.

🙏 On-demand hook installation. System hooks are installed individually as needed.

🧩 Plug in your own native input handler to process keyboard events, mouse events, or both.

Targets .NET 10. Written in C# and C++/CLI.

// Subscribe to the letter K.
var subscription = await inputHook.SubscribeAsync(Key.K, KeyState.Up, evt =>
{
    Console.WriteLine($"Keyboard event! {evt.Key} {evt.KeyState}");
});

subscription.Dispose(); // Unsubscribe.

// Subscribe to right button clicks.
using var _ = await inputHook.SubscribeAsync(MouseAction.RightButtonUp, evt =>
{
    Console.WriteLine($"Mouse event! {evt.Action}");
});

// Register your own native input handler.
using var _ = await inputHook.RegisterHandlerAsync(new CustomInputHandler());

See InputHook for the full API, or ExampleApp1 for more examples.

About

Low-latency keyboard and mouse hooks for .NET console and non-UI applications.

Topics

Resources

License

Stars

0 stars

Watchers

0 watching

Forks

Contributors