KeyMouseHook 1.0.6
.NET Framework 4.0
dotnet add package KeyMouseHook --version 1.0.6
NuGet\Install-Package KeyMouseHook -Version 1.0.6
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="KeyMouseHook" Version="1.0.6">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add KeyMouseHook --version 1.0.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: KeyMouseHook, 1.0.6"
#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 KeyMouseHook as a Cake Addin
#addin nuget:?package=KeyMouseHook&version=1.0.6
// Install KeyMouseHook as a Cake Tool
#tool nuget:?package=KeyMouseHook&version=1.0.6
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
What it does?
This is an extension to globalmousekeyhook and InputSimulator library which allows you to tap keyboard and mouse, to detect and record their activity event when an application is inactive and runs in background.The Windows Input Simulator provides a simple .NET(C#) interface to simulate Keyboard or Mouse input using the Win32 SendInput method.
Prerequisites
- Windows: .Net Framework 4.0+
Installation and sources
nuget install KeyMouseHook
Usage
private readonly KeyMouseFactory eventHookFactory = new KeyMouseFactory(HookType.GlobalEvents);
private readonly KeyboardWatcher keyboardWatcher;
private readonly MouseWatcher mouseWatcher;
private List<MouseKeyEvent> _mouseKeyEvents;
public FormMain()
{
InitializeComponent();
keyboardWatcher = eventHookFactory.GetKeyboardWatcher();
keyboardWatcher.OnKeyboardInput += (s, e) =>
{
if (_mouseKeyEvents != null)
_mouseKeyEvents.Add(e);
};
mouseWatcher = eventHookFactory.GetMouseWatcher();
mouseWatcher.OnMouseInput += (s, e) =>
{
if (_mouseKeyEvents != null)
_mouseKeyEvents.Add(e);
};
}
private void StartWatch(IKeyboardMouseEvents events = null)
{
_macroEvents = new List<MacroEvent>();
keyboardWatcher.Start(events);
mouseWatcher.Start(events);
}
private void StopWatch()
{
keyboardWatcher.Stop();
mouseWatcher.Stop();
}
private void Playback()
{
var sim = new InputSimulator();
sim.PlayBack(_macroEvents);
}
keyboardWatcher = eventHookFactory.GetKeyboardWatcher().Disable(MacroEventType.KeyDown | MacroEventType.KeyUp).Enable(MacroEventType.KeyPress);
mouseWatcher = eventHookFactory.GetMouseWatcher().Enable(MacroEventType.MouseDoubleClick | MacroEventType.MouseDragStarted).Disable(MacroEventType.MouseDragFinished | MacroEventType.MouseMove);
var sim = new InputSimulator().Enable(MacroEventType.MouseDoubleClick | MacroEventType.KeyPress).Disable(MacroEventType.MouseMove | MacroEventType.KeyDown | MacroEventType.KeyUp);
(also have a look at the Demo app included with the source)
Screen Shots
Thanks
- globalmousekeyhook (MIT License)
- InputSimulator (MIT License)
Quick contributing guide
- Fork and clone locally
- Create a topic specific branch. Add some nice feature.
- Send a Pull Request!
License
The MIT license see: LICENSE
Product | Versions |
---|---|
.NET Framework | net40 net403 net45 net451 net452 net46 net461 net462 net463 net47 net471 net472 net48 net481 |
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.
-
- MouseKeyHook (>= 5.6.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories (3)
Showing the top 3 popular GitHub repositories that depend on KeyMouseHook:
Repository | Stars |
---|---|
BookerLiu/GeekDesk
小巧、美观的桌面快速启动工具
|
|
CXWorld/CapFrameX
Frametime capture and analysis tool
|
|
KaustubhPatange/Kling
A utility to show keyboard keys visually on the Windows screen.
|