RawInput.Sharp
0.2.0
dotnet add package RawInput.Sharp --version 0.2.0
NuGet\Install-Package RawInput.Sharp -Version 0.2.0
<PackageReference Include="RawInput.Sharp" Version="0.2.0" />
<PackageVersion Include="RawInput.Sharp" Version="0.2.0" />
<PackageReference Include="RawInput.Sharp" />
paket add RawInput.Sharp --version 0.2.0
#r "nuget: RawInput.Sharp, 0.2.0"
#:package RawInput.Sharp@0.2.0
#addin nuget:?package=RawInput.Sharp&version=0.2.0
#tool nuget:?package=RawInput.Sharp&version=0.2.0
RawInput.Sharp
A simple wrapper library for Windows Raw Input.
Target frameworks
Starting with version 0.2.0, the library targets .NET 8 (net8.0).
The sample applications target .NET 8 for Windows (net8.0-windows).
If you need .NET Standard 1.1 or .NET Framework support, use the 0.1.3
compatibility release.
NuGet
https://www.nuget.org/packages/RawInput.Sharp/
Version 0.2.0 targets .NET 8.0 and later. If you need a build for .NET Standard 2.0, netstandard1.1, or an older .NET Framework target, use version 0.1.3.
Usage
Acquiring connected devices
// using Linearstar.Windows.RawInput;
// Get the devices that can be handled with Raw Input.
var devices = RawInputDevice.GetDevices();
// Keyboards will be returned as RawInputKeyboard.
var keyboards = devices.OfType<RawInputKeyboard>();
// Mice will be RawInputMouse.
var mice = devices.OfType<RawInputMouse>();
Reading raw inputs
protected override void WndProc(ref Message m)
{
const int WM_INPUT = 0x00FF;
// You can read inputs by processing the WM_INPUT message.
if (m.Msg == WM_INPUT)
{
// Create an RawInputData from the handle stored in lParam.
var data = RawInputData.FromHandle(m.LParam);
// You can identify the source device using Header.DeviceHandle or just Device.
var sourceDeviceHandle = data.Header.DeviceHandle;
var sourceDevice = data.Device;
// The data will be an instance of either RawInputMouseData, RawInputKeyboardData, or RawInputHidData.
// They contain the raw input data in their properties.
switch (data)
{
case RawInputMouseData mouse:
Console.WriteLine(mouse.Mouse);
break;
case RawInputKeyboardData keyboard:
Console.WriteLine(keyboard.Keyboard);
break;
case RawInputHidData hid:
Console.WriteLine(hid.Hid);
break;
}
}
base.WndProc(ref m);
}
Further examples
- RawInput.Sharp.SimpleExample
- A simple example that shows keyboard input events.
- RawInput.Sharp.SimpleExample.WPF
- WPF version of the prior one.
- RawInput.Sharp.DigitizerExample
- An example handling digitizers, such as pen tablets, touch screens, and touch pads.
License
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on RawInput.Sharp:
| Package | Downloads |
|---|---|
|
Qian.BarcodeScanner.WPF
Package Description |
GitHub repositories (12)
Showing the top 12 popular GitHub repositories that depend on RawInput.Sharp:
| Repository | Stars |
|---|---|
|
lively-community/lively
Free and open-source software that allows users to set animated desktop wallpapers and screensavers powered by WinUI 3.
|
|
|
ClassIsland/ClassIsland
一款功能强、可定制、跨平台,适用于班级多媒体屏幕的课表信息显示工具,可以一目了然地显示各种信息。
|
|
|
Maassoft/ColorControl
Easily change NVIDIA display settings and/or control LG TV's
|
|
|
Taiizor/Sucrose
Sucrose is a versatile wallpaper engine that brings life to your desktop with a wide range of interactive wallpapers.
|
|
|
Artemis-RGB/Artemis
Provides advanced unified lighting across many different brands RGB peripherals
|
|
|
Meowmaritus/DSAnimStudio
Direct3D-Accelerated Dark Souls TAE Editor
|
|
|
LanZhan-Harmony/WindowsMusicPlayer-TheUntamedMusicPlayer
WinUI开发的现代化Windows在线和本地音乐播放器
|
|
|
Yoooi0/MultiFunPlayer
flexible application to synchronize various devices with media playback
|
|
|
project-sbc/Handheld-Control-Panel
|
|
|
Gainedge/BetterExplorer
A Better Explorer is a filemanager replacement that adds several handy features for productive file management.
|
|
|
lindexi/lindexi_gd
博客用到的代码
|
|
|
BetterWorld-Liuser/XiaoChao
Windows端的快捷键提示工具
|
See the GitHub release notes for this version.