NonInvasiveKeyboardHookLibrary 2.0.0
See the version list below for details.
dotnet add package NonInvasiveKeyboardHookLibrary --version 2.0.0
NuGet\Install-Package NonInvasiveKeyboardHookLibrary -Version 2.0.0
<PackageReference Include="NonInvasiveKeyboardHookLibrary" Version="2.0.0" />
<PackageVersion Include="NonInvasiveKeyboardHookLibrary" Version="2.0.0" />
<PackageReference Include="NonInvasiveKeyboardHookLibrary" />
paket add NonInvasiveKeyboardHookLibrary --version 2.0.0
#r "nuget: NonInvasiveKeyboardHookLibrary, 2.0.0"
#addin nuget:?package=NonInvasiveKeyboardHookLibrary&version=2.0.0
#tool nuget:?package=NonInvasiveKeyboardHookLibrary&version=2.0.0
NonInvasiveKeyboardHook
A C# hotkey manager that uses a low level global hook, but allows registering for specific keys to reduce invasion of user privacy.
Get it on NuGet
https://www.nuget.org/packages/NonInvasiveKeyboardHookLibrary/
Example
var keyboardHookManager = new KeyboardHookManager();
keyboardHookManager.Start();
// Register virtual key code 0x60 = NumPad0
keyboardHookManager.RegisterHotkey(0x60, () =>
{
Debug.WriteLine("NumPad0 detected");
});
// Modifiers are supported too
keyboardHookManager.RegisterHotkey(NonInvasiveKeyboardHookLibrary.ModifierKeys.Control, 0x60, () =>
{
Debug.WriteLine("Ctrl+NumPad0 detected");
});
// Multiple modifiers can be specified using the bitwise OR operation
keyboardHookManager.RegisterHotkey(NonInvasiveKeyboardHookLibrary.ModifierKeys.Control | NonInvasiveKeyboardHookLibrary.ModifierKeys.Alt, 0x60, () =>
{
Debug.WriteLine("Ctrl+Alt+NumPad0 detected");
});
// Or as an array of modifiers
keyboardHookManager.RegisterHotkey(new[]{NonInvasiveKeyboardHookLibrary.ModifierKeys.Control, NonInvasiveKeyboardHookLibrary.ModifierKeys.Alt}, 0x60, () =>
{
Debug.WriteLine("Ctrl+Alt+NumPad0 detected");
});
Sample App
I created a GUI C# app to help test this library: https://github.com/kfirprods/ShortcutHotkeysExample
If the examples above did not answer your questions, take a look at the source code of the sample app 😃
Read more about Global Hotkeys within Windows applications
For a thorough explanation, look at the CodeProject article: https://www.codeproject.com/Articles/1273010/Global-Hotkeys-within-Desktop-Applications
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net452 is compatible. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
This package has no dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories (1)
Showing the top 1 popular GitHub repositories that depend on NonInvasiveKeyboardHookLibrary:
Repository | Stars |
---|---|
Invvard/EZLayoutDisplay
Learn your custom layout quickly and easily by displaying your ErgoDox layout right from your desktop !
|
Significant improvement in detection of modifier keys. Events will now fire as soon as a key combination is down, rather than waiting for keys to be released.