NonInvasiveKeyboardHookLibrary 1.5.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package NonInvasiveKeyboardHookLibrary --version 1.5.0
                    
NuGet\Install-Package NonInvasiveKeyboardHookLibrary -Version 1.5.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NonInvasiveKeyboardHookLibrary" Version="1.5.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NonInvasiveKeyboardHookLibrary" Version="1.5.0" />
                    
Directory.Packages.props
<PackageReference Include="NonInvasiveKeyboardHookLibrary" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add NonInvasiveKeyboardHookLibrary --version 1.5.0
                    
#r "nuget: NonInvasiveKeyboardHookLibrary, 1.5.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package NonInvasiveKeyboardHookLibrary@1.5.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=NonInvasiveKeyboardHookLibrary&version=1.5.0
                    
Install as a Cake Addin
#tool nuget:?package=NonInvasiveKeyboardHookLibrary&version=1.5.0
                    
Install as a Cake Tool

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

Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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.2.0 1,641 10/22/2022
2.1.1 1,205 5/20/2021
2.1.0 1,741 11/8/2020
2.0.0 593 11/7/2020
1.5.0 883 10/26/2019
1.4.0 920 3/12/2019
1.3.0 1,585 12/29/2018
1.2.0 1,036 12/28/2018
1.1.0 1,009 12/26/2018
1.0.1 988 12/23/2018
1.0.0 1,044 12/21/2018

The Start() and Stop() methods can now be called multiple times without consequences.