Questions tagged [mousekeyhook]

The .NET library allows you to tap keyboard and mouse, to detect and record their activity even when an application is inactive and runs in background.

Introduction

This library attaches to windows global hooks, tracks keyboard and mouse clicks and movement and raises common .NET events with KeyEventArgs and MouseEventArgs, so you can easily retrieve any information you need:

  • Mouse coordinates
  • Mouse buttons clicked
  • Mouse wheel scrolls
  • Key presses and releases
  • Special key states

    Additionally, there are MouseEventExtArgs and KeyEventExtArgs which provide further options:

  • Input suppression
  • Timestamp
  • IsMouseDown/Up
  • IsKeyDown/Up.

Prerequisites

  • Windows: .Net 4.0+

Installation and sources

  nuget install MouseKeyHook

Troubleshooting and support

37 questions
3
votes
1 answer

Global hook mousedown and keypress events are not firing

I've used the exact same code in my c# desktop application as it is given in here : https://github.com/gmamaladze/globalmousekeyhook It works and fires the mousedown and keypress events as long as the application is in focus. If i'm on another…
Amit Andharia
  • 909
  • 1
  • 8
  • 16
2
votes
1 answer

Binding key combinations (strictly) to a specific form

Could you please tell me how to use the "globalmousekeyhook" library (https://github.com/gmamaladze/globalmousekeyhook/blob/vNext/keycomb.md) to write keyboard shortcuts Not to the whole application, but to a specific form? To avoid checking the…
Tatami
  • 105
  • 1
  • 7
2
votes
1 answer

Mouse freezing/lagging when hit breakpoint

Goal: To be able to find point(X,Y) of element on windows desktop application which been clicked without performing click itself. Not working solution I've added mousekeyhook Nuget package to my .net core WPF application, it working fine ( when…
Lior Dadon
  • 233
  • 2
  • 10
2
votes
3 answers

how to import a library in my case MouseKeyHook?

I just started programming in c# and I don't know how to import a library. I need "globalmousekeyhook" in my program. Can someone can help me? Thank you! ^^ Link to the library: https://github.com/gmamaladze/globalmousekeyhook
2
votes
2 answers

Intercept Mouse Click

I'm currently writing a program that holds down a mouse button when initially clicked, and continues to hold it until the user presses the mouse button for a second time. The program works by detecting input globally using a MouseHookListener and…
Liam Kelly
  • 231
  • 3
  • 15
1
vote
0 answers

Hotkey with MouseKeyHook not catching event in C#

I'm building a word lookup application that runs in system tray and when you scan a block of a few words and then press a hotkey combination like Shift + C + V for example. However, the problem is that when I test it on my personal machine, it works…
Quang Tran
  • 11
  • 2
1
vote
0 answers

Return value from async Hook.GlobalEvents()MouseDown

At the moment I am using a example code from the internet, but I want to change it so I can get the value of the mousebutton that is pressed down as an string value to use further in the Form1.cs under a button. The problem is I can't really get the…
Giorgio R
  • 11
  • 4
1
vote
1 answer

Windows Hooks do not trigger events and windows starts lagging. (Using globalmousekeyhook in C#)

I currently work with the Steelseries GameSense SDK to make my own effects etc. for my keyboard and mouse. To light up my mouse and keyboard on clicks and presses, I use the globalmousekeyhook library. Unfortunately, the mouse and keyboard events…
Habetuz
  • 111
  • 1
  • 6
1
vote
1 answer

How to fix error KeyEventHandler in c# console application?

I have a problem that when executing this code in my winform application, it runs normally but when running on the console it gets an error message, it seems that KeyEventHandler is only used in winform, yes What can be replaced in the console…
CongSyIT
  • 61
  • 6
1
vote
1 answer

Unregistering hotkeys at runtime with MouseKeyHook

I want to allow users to re-assign hotkeys at runtime and am using the Gma.System.MouseKeyHook NuGet package. Creating new hotkeys at runtime works just fine and dandy but clearing the Action of an already assigned Combination/Sequence (by setting…
tkefauver
  • 491
  • 5
  • 19
1
vote
1 answer

I cannot hook the keyboard globally in elevated Windows applications

I am creating a clipboard monitor that will catch changes in clipboard and then convert the clipboard to pure text only. As such this works fine but I really cannot figure out why my application does not hook the keyboard when being inside an…
Beauvais
  • 2,149
  • 4
  • 28
  • 63
1
vote
1 answer

MouseKeyHook 'CallbackOnCollectedDelegate' Issue

I am using Gma.System.MouseKeyHook and getting the following exception: Managed Debugging Assistant 'CallbackOnCollectedDelegate' Message=Managed Debugging Assistant 'CallbackOnCollectedDelegate' : 'A callback was made on a garbage collected…
1
vote
0 answers

Crash in MouseKeyHook

can some one take a look to my C# source that has a crash issue? The program is supposed to omit unwanted double clicks the mouse sometimes sends and it works but after a while using the program it crashes. The line that crashes: Application.Run(new…
Coder547
  • 119
  • 9
1
vote
1 answer

KeyPress event not firing when using MouseKeyHook

I started using MouseKeyHook library couple of days ago to intercept keyboard buttons for an application that we're building (the application uses numerical keyboard as input to send specific messages through Akka, etc). I've managed to get it to…
Milan Stojanovic
  • 307
  • 1
  • 14
1
vote
0 answers

CallbackOnCollectedDelegate in mousekeyhook

I'm using https://github.com/gmamaladze/globalmousekeyhook for a program. The hook fires, but after some time there comes a CallbackOnCollectedDelegate and i don't have the knowledge for changing the code from github. I couldn't transform the help…
francisz
  • 21
  • 3
1
2 3