GlobalHotKeyCore 1.2.0

dotnet add package GlobalHotKeyCore --version 1.2.0
NuGet\Install-Package GlobalHotKeyCore -Version 1.2.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="GlobalHotKeyCore" Version="1.2.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add GlobalHotKeyCore --version 1.2.0
#r "nuget: GlobalHotKeyCore, 1.2.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.
// Install GlobalHotKeyCore as a Cake Addin
#addin nuget:?package=GlobalHotKeyCore&version=1.2.0

// Install GlobalHotKeyCore as a Cake Tool
#tool nuget:?package=GlobalHotKeyCore&version=1.2.0

Global Hot Key Core

Provides an easy way to setup system-wide hot keys and react on their events. Works well in both, WPF and WebForms applications without any need to use Windows API. This fork added .NET Core 3.1+ support.

Installation

Th package is available through the NuGet by running the command

PM> Install-Package GlobalHotKeyCore

Usage

An example below demonstrates how to register system-wide hotkey Ctrl+Alt+F5 and handle it:

// Include required namespaces.
using System.Windows.Input;
using GlobalHotKey;

// Create the hotkey manager.
hotKeyManager = new HotKeyManager();

// Register Ctrl+Alt+F5 hotkey. Save this variable somewhere for the further unregistering.
var hotKey = hotKeyManager.Register(Key.F5, ModifierKeys.Control | ModifierKeys.Alt);

// Handle hotkey presses.
hotKeyManager.KeyPressed += HotKeyManagerPressed;

private void HotKeyManagerPressed(object sender, KeyPressedEventArgs e)
{
    if (e.HotKey.Key == Key.F5)
        MessageBox.Show("Hot key pressed!");
}

// Unregister Ctrl+Alt+F5 hotkey.
hotKeyManager.Unregister(hotKey);

// Dispose the hotkey manager.
hotKeyManager.Dispose();

HotKeyManager class registers and unregisters system-wide hotkeys, handles them, and raises an event on hotkeys pressing. KeyPressedEventArgs class contains information about pressed hotkey and keys modifiers. Note, that it is not necessary to unregister all hotkeys manually before closing application, because Dispose() does it. Make sure that it is called.

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.1 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETCoreApp 3.1

    • 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
1.2.0 1,631 2/24/2020