CSInputs 1.0.4
dotnet add package CSInputs --version 1.0.4
NuGet\Install-Package CSInputs -Version 1.0.4
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="CSInputs" Version="1.0.4" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CSInputs --version 1.0.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: CSInputs, 1.0.4"
#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 CSInputs as a Cake Addin #addin nuget:?package=CSInputs&version=1.0.4 // Install CSInputs as a Cake Tool #tool nuget:?package=CSInputs&version=1.0.4
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
CSInputs
This library lets you send and read mouse and keyboard input from windows.
Usage Examples
To Send
Keyboard Inputs:
SendInput.Keyboard.Send(Enums.KeyboardKeys.F1);
SendInput.Keyboard.Send(Enums.KeyboardKeys.F1,Enums.KeyFlags.Down);
SendInput.Keyboard.Send(Enums.KeyboardKeys.F1,Enums.KeyFlags.Up);
SendInput.Keyboard.SendChar('A');
SendInput.Keyboard.SendString("Hello World!");
Mouse Inputs:
SendInput.Mouse.Send(Enums.MouseKeys.MouseLeft);
SendInput.Mouse.Send(Enums.MouseKeys.MouseLeft,Enums.KeyFlags.Down);
SendInput.Mouse.Send(Enums.MouseKeys.MouseLeft,Enums.KeyFlags.Up);
SendInput.Mouse.Send(Enums.MouseKeys.MouseLeft,Enums.KeyFlags.Down,new Point(150, 123),Enums.MousePositioning.Absolute);
SendInput.Mouse.Send(Enums.MouseKeys.MouseLeft,Enums.KeyFlags.Down,new Point(-5, -30),Enums.MousePositioning.Relative);
SendInput.Mouse.MoveTo(new Point(150, 123), Enums.MousePositioning.Absolute);
To Listen
First you need to instantiate a input listener.
ReadInput.InputListener listener = new ReadInput.InputListener();
Then you can register for keyboard or mouse events to listen inputs.
listener.KeyboardInputs += Listener_KeyboardInputs;
listener.MouseInputs += Listener_MouseInputs;
Sample Console Application
using System;
// System.Windows.Forms is required to work on console applications.
using System.Windows.Forms;
using CSInputs.Enums;
using CSInputs.ReadInput;
using CSInputs.Structs;
internal class Program
{
static void Main(string[] args)
{
// Instantiate InputListener
InputListener inputListener = new InputListener();
// Add KeyboardInputs event handler to listen keyboard inputs.
inputListener.KeyboardInputs += InputListener_KeyboardInputs;
// Add MouseInputs event handler to listen mouse inputs.
inputListener.MouseInputs += InputListener_MouseInputs;
Application.Run(); // Required to work on console applications,
}
private static void InputListener_MouseInputs(MouseData data, ref ModifierKey modifierKey)
{
if (data.Key == MouseKeys.MouseRight && data.Flags == KeyFlags.Up)
Console.WriteLine("Someone just released the \"Right Click\"!");
}
private static void InputListener_KeyboardInputs(KeyboardData data, ref ModifierKey modifierKey)
{
if (data.Key == KeyboardKeys.Space && data.Flags == KeyFlags.Up)
Console.WriteLine("Someone just released the \"Space\" key!");
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net35 is compatible. net40 is compatible. net403 was computed. net45 is compatible. net451 is compatible. net452 is compatible. net46 is compatible. net461 is compatible. net462 is compatible. net463 was computed. net47 is compatible. net471 is compatible. net472 is compatible. net48 is compatible. net481 is compatible. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
.NETFramework 3.5
- No dependencies.
-
.NETFramework 4.0
- No dependencies.
-
.NETFramework 4.0.3
- No dependencies.
-
.NETFramework 4.5
- No dependencies.
-
.NETFramework 4.5.1
- No dependencies.
-
.NETFramework 4.6
- No dependencies.
-
.NETFramework 4.6.1
- No dependencies.
-
.NETFramework 4.6.2
- No dependencies.
-
.NETFramework 4.7
- No dependencies.
-
.NETFramework 4.7.1
- No dependencies.
-
.NETFramework 4.7.2
- No dependencies.
-
.NETFramework 4.8
- No dependencies.
-
.NETFramework 4.8.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.
x64 support added