Mrousavy Hotkeys Save

:abc: A small C# (.NET) Library which allows binding of global HotKeys to any Application's Windows (including Windows Apps such as explorer.exe), even in Background. (using P/Invokes)

Project README

Hotkeys

A small C# (.NET) Library which allows binding of global HotKeys to any Application's Windows (including Windows Apps such as explorer.exe), even in Background. (using P/Invokes)

Install

Install from NuGet

Install-Package GlobalHotkeys

NuGet

(or download the Library (.dll) manually)

Buy Me a Coffee at ko-fi.com

Usage

Example (C#, in a WPF Application):

using mrousavy;
// ...
var key = new HotKey(
    (ModifierKeys.Control | ModifierKeys.Alt), 
    Key.S, 
    this, 
    (hotkey) => {
        MessageBox.Show("Ctrl + Alt + S was pressed!");
    }
);
// ...
key.Dispose();

Note #1: Since HotKey implements the IDisposable interface, you must call Dispose() to unregister the Hotkey, e.g. when your Window closes. Keep in mind that when you're using using(...) { ... }, the HotKey gets unregistered and disposed once you exit the using-statement's scope.

Note #2: Use the binary or operator (|) to combine key combinations for the constructor.

Note #3: Use a Window Reference as the third Argument. This may be a WPF Window, a WindowInteropHelper, or a Window Handle (IntPtr). So you can use your own WPF/WinForms Window, as well as another process's Window using it's Handle. Keep in mind that this is sketchy behaviour and not the intention of this library.

Open Source Agenda is not affiliated with "Mrousavy Hotkeys" Project. README Source: mrousavy/Hotkeys
Stars
78
Open Issues
1
Last Commit
3 years ago
Repository
License
MIT

Open Source Agenda Badge

Open Source Agenda Rating