Loading repository data…
Loading repository data…
nazar650 / repository
FastKeySimulator is a lightweight C# library for simulating keyboard and mouse input using the Windows SendInput API. It enables easy automation of key presses, mouse clicks, scrolling, and cursor movement.
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
The FastKeySimulator library for C# allows programmatic control of the keyboard and mouse in Windows via the WinAPI. It uses the low-level SendInput API, which emulates physical key presses, mouse clicks, and cursor movements. Key Features
The FastKeySim class allows you to easily simulate keyboard and mouse input in your C# applications. You can press single keys or key combinations with a single method call, without worrying about low-level WinAPI details.The KeyboardClick() method allows you to simulate pressing single keys or key combinations on the keyboard with just one call. It handles both the press and release events, so Windows sees it as a real key press.
using FastKeySimulator;
internal class Program
{
private static async Task Main(string[] args)
{
FastKeySim fast=new FastKeySim();
// Press a single key
await fast.KeyBoardClick(0,ScanCode.W);
// Press a key combination (0,RShift + w)
await fast.KeyBoardClick(0,ScanCode.RShift,ScanCode.W");
// Press multiple keys (0,Alt + RShift)
await fast.KeyBoardClick(0,ScanCode.Alt,ScanCode.RShift);
}
}
The FastKeySim class also provides powerful tools for simulating mouse input in your C# applications. It allows you to perform mouse clicks, scroll the mouse wheel, move the cursor to specific screen positions, and create smooth cursor movements - all with simple and high-level method calls.
The MouseClick() method allows you to simulate left, right, and middle mouse button clicks. It automatically handles both the press and release events, so Windows recognizes the action as a real physical mouse click.
The MouseScrollWheel() method allows you to simulate mouse wheel scrolling. You can scroll up or down by specifying the number of steps and control the scrolling speed using a time delay.
The MouseSetCursorPos() method allows you to instantly move the mouse cursor to any position on the screen using absolute coordinates.
The CursorMotion() method allows you to smoothly move the mouse cursor by a specified number of pixels.
using FastKeySimulator;
internal class Program
{
private static void Main(string[] args)
{
FastKeySim fast=new FastKeySim();
// Left mouse click
fast.MouseClick(Mouse.Left);
// Right mouse click
fast.MouseClick(Mouse.Right);
// Middle mouse click
fast.MouseClick(Mouse.Middle);
}
}
using FastKeySimulator;
internal class Program
{
private static async Task Main(string[] args)
{
FastKeySim fast=new FastKeySim();
// Scroll up 3 steps
await fast.MouseScrollWheel(3, 10);
// Scroll down 2 steps
await fast.MouseScrollWheel(-2, 15);
}
}
Moves the mouse cursor to an absolute screen position.
using FastKeySimulator;
internal class Program
{
private static void Main(string[] args)
{
FastKeySim fast=new FastKeySim();
// Move cursor to position (500, 300)
fast.MouseSetCursorPos(500, 300);
// Move cursor to top-left corner
fast.MouseSetCursorPos(0, 0);
}
}
using FastKeySimulator;
internal class Program
{
private static async Task Main(string[] args)
{
FastKeySim fast=new FastKeySim();
Thread.Sleep(6000);
//Moves 200px right, 100px down, in 20 steps, with 10ms delay.
await fast.CursorMotion(200, 100, 20, 10);
}
}