NonInvasiveKeyboardHookLibrary 1.4.0

Non-Invasive Keyboard Hook

A hotkey manager that uses a low-level keyboard hook in a way that avoids invading the user's privacy, by invoking callbacks only when specific registered keys are hit.

Install-Package NonInvasiveKeyboardHookLibrary -Version 1.4.0
dotnet add package NonInvasiveKeyboardHookLibrary --version 1.4.0
<PackageReference Include="NonInvasiveKeyboardHookLibrary" Version="1.4.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NonInvasiveKeyboardHookLibrary --version 1.4.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.

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");
});

For more code examples, look at the example project: https://github.com/kfirprods/ShortcutHotkeysExample

For a thorough explanation, look at the CodeProject article: https://www.codeproject.com/Articles/1273010/Global-Hotkeys-within-Desktop-Applications

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");
});

For more code examples, look at the example project: https://github.com/kfirprods/ShortcutHotkeysExample

For a thorough explanation, look at the CodeProject article: https://www.codeproject.com/Articles/1273010/Global-Hotkeys-within-Desktop-Applications

Release Notes

Critical thread safety fix

Dependencies

This package has no dependencies.

This package is not used by any popular GitHub repositories.

Version History

Version Downloads Last updated
1.4.0 168 3/12/2019
1.3.0 170 12/29/2018
1.2.0 134 12/28/2018
1.1.0 140 12/26/2018
1.0.1 117 12/23/2018
1.0.0 127 12/21/2018