NonInvasiveKeyboardHookLibrary 2.1.1

Install-Package NonInvasiveKeyboardHookLibrary -Version 2.1.1
dotnet add package NonInvasiveKeyboardHookLibrary --version 2.1.1
<PackageReference Include="NonInvasiveKeyboardHookLibrary" Version="2.1.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add NonInvasiveKeyboardHookLibrary --version 2.1.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: NonInvasiveKeyboardHookLibrary, 2.1.1"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install NonInvasiveKeyboardHookLibrary as a Cake Addin
#addin nuget:?package=NonInvasiveKeyboardHookLibrary&version=2.1.1

// Install NonInvasiveKeyboardHookLibrary as a Cake Tool
#tool nuget:?package=NonInvasiveKeyboardHookLibrary&version=2.1.1
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

.NET Framework Version

.NET Core Version

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 😃 Keyboard Shortcuts In-App Screenshot

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

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.1.1 347 5/20/2021
2.1.0 1,126 11/8/2020
2.0.0 222 11/7/2020
1.5.0 510 10/26/2019
1.4.0 516 3/12/2019
1.3.0 733 12/29/2018
1.2.0 575 12/28/2018
1.1.0 550 12/26/2018
1.0.1 521 12/23/2018
1.0.0 562 12/21/2018

Removed Debug.WriteLines from hook