Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Windows HotKey handler without dependency on keyboard hooks, Windows Forms, WPF.

License

NotificationsYou must be signed in to change notification settings

steamcore/TinyHotKey

Repository files navigation

NuGetBuild

TinyHotKey is a Windows HotKey handler with no dependency on Windows Forms or WPF that only listento specified key combinations. It usesRegisterHotKey from the Win32 API directly on a dedicatedthread using a hidden window, avoiding global hooks.

Simple example

usingvartinyHotKey=newTinyHotKeyInstance();usingvarregistration=tinyHotKey.RegisterHotKey(Modifier.Control|Modifier.Alt,Key.D,()=>{Console.WriteLine("Ctrl+Alt+D detected");returnTask.CompletedTask;});

Example using dependency injection

// Add TinyHotKey to your DI container with logging supportservices.AddTinyHotKey();// In a service with a dependency on ITinyHotKeyusingvarregistration=tinyHotKey.RegisterHotKey(Modifier.Control|Modifier.Alt,Key.D,()=>{Console.WriteLine("Ctrl+Alt+D detected");returnTask.CompletedTask;});

Why TinyHotKey?

Unlike other projects TinyHotKey has no dependency on Windows Form or WPF and does not use globalhooks, which makes it possible to avoid keylogger-like behavior and also support trimming and AOT.

It is possible to use TinyHotKey in alternate UI frameworks such as Avalonia or even in consoleapplications.

How it works

The Windows hotkey mechanism works by detecting keyboard combinations and posting messages to aWindow. TinyHotKey creates a hidden Window on a dedicated thread using Win32 calls, handlingall hotkey interactions and invoking callbacks on a new task off the "UI" thread. This approachallows it to work in any kind of application running on Windows without relying on Windows Formsor WPF which are not trimming or AOT compatible.

About

Windows HotKey handler without dependency on keyboard hooks, Windows Forms, WPF.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp