🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

KeyboardHookLite

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

KeyboardHookLite

A lightweight low-level global windows keyboard hook compatible with modern UI frameworks (WPF, MAUI, WinUI 3, etc.)

1.1.4
Source
NuGet
Version published
Maintainers
1
Created
Source

NuGet Version Target Framework Target Framework Target Framework

🎯 Features

  • Lightweight low-level global keyboard hook with minimal dependencies.
  • Designed to work with modern UI frameworks (WPF, MAUI, WinUI 3) out of the box - no fiddling with outdated namespaces and Key types.
  • Uses PInvoke signatures in order to avoid reliance on CsWin32 source generator.
  • Source code is commented and thoroughly explained to allow you to expand functionality.
  • Proper garbage disposal of unmanaged code to prevent memory leaks.
  • Usage guide below allows you to get up and running quickly.

⚡️ Usage Guide

Bring in the namespace

Console Application

WPF / WinUI 3 / Other

It is essentially the same as the code for the console application above. You can omit System.Windows.Threading.Dispatcher.Run(); as UI frameworks already have a message queue. You can initialize the keyboard hook wherever you choose, whether it be upon a click or when the screen is initialized. Please remember to dispose (kbh.Dispose();) when you no longer require the hook.

KeyboardHookEventArgs features

KeyboardHookEventArgs contains the property KeyPressType and InputEvent which is of type LowLevelKeyboardInputEvent. See below for what that entails. If you would like to add further functionality, you can do so by adding properties to the KeyboardHookEventArgs class.

License

MIT

Keywords

keyboard

FAQs

Package last updated on 29 May 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts