Questions tagged [mouse-hook]

Changing, listening or reacting to events related to specific mouse events.

A mouse hook is a feature that allows to replace or extend the standard behavior for specific mouse events in a systematic way.

The hook may work at a low level, by replacing some system routines at operating system level or at driver level. It is different from a simple event listener, in that the hooks behavior is not specific for a software feature, but is general to the whole application or event to the whole system.

Related tags

  • Use tag for hooking other event drivers than those of the mouse.
  • Use age for hooking mouse keys and keyboard keys
  • Use tag for .Net mouse key hooking

See also

92 questions
17
votes
2 answers

What does WPF use to capture mouse and keyboard input?

I globally (system-wide) filter certain mouse clicks using SetWindowsHookEx and WH_MOUSE_LL. The problem is it doesn't work for WPF applications (all WPF applications detect mouse clicks whether or not I have instructed the system to ignore these…
Paya
  • 5,124
  • 4
  • 45
  • 71
6
votes
1 answer

C# low level mouse hook and form event handling

I'm using a simple form generated by VS 2010 which contains 2 buttons, start and stop. Start triggers WH_MOUSE_LL using SetWindowsHookEx, and stop stops the hook. The hook works fine and I mange to "replace" middle mouse button click with double…
Alex
  • 61
  • 2
5
votes
6 answers

SetWindowsHook stops working after some time

I defined a global hook on WM_MOUSE that works perfectly for some time. It post a message to a specific window each time the mouse move. After some random time the hook stop sending messages. If I unregister and register the hook it works again. I…
Emmanuel Caradec
  • 2,302
  • 1
  • 19
  • 38
5
votes
2 answers

Set mouse position not working c#

I've been trying to write a small utility that will modify the boundaries of where my mouse can go on the whole screen. I've used the the global mouse hook library that I found here (I'm using version 1), and then pass the mouse position information…
littlerat
  • 51
  • 2
4
votes
1 answer

Hooking the 3rd X-Mouse button?

I wrote a low-level mouse hook in C#, which should capture XBUTTON events. For the 1st and 2nd xButton it works just fine, but there is no message for the 3rd xButton on my mouse. It seems like there is no possible way to capture events for that…
alex
  • 1,228
  • 1
  • 16
  • 38
4
votes
2 answers

How can I disable mouse click event system wide using C#?

I have a laptop with a very sensitive touch pad, and wanted to code a small program that could block the mouse input when I was typing a paper or something. I didn't think it would be hard to do, considering everything I've seen on low-level hooks,…
Jess
  • 8,628
  • 6
  • 49
  • 67
4
votes
1 answer

Is it possible to implement global raw input?

I have two mice connected to my computer and I want to make a logger that distinguishes between these two. The Low-Level Mouse hook doesn't supply me that information so I have thought about catching Raw Input messages in order to get the Device…
OrMiz
  • 265
  • 2
  • 11
4
votes
0 answers

GET_WHEEL_DELTA_WPARAM(wParam) in mouse hook returning 0

MSG msg; LRESULT CALLBACK MouseHookProc(int nCode, WPARAM wParam, LPARAM lParam) { if (nCode >= 0) { if (wParam == WM_MOUSEWHEEL) cout << GET_WHEEL_DELTA_WPARAM(wParam) << endl; //prints 0 } return CallNextHookEx(0, nCode, wParam,…
asqapro
  • 175
  • 3
  • 15
3
votes
0 answers

Global mouse hook in C# application

I want to create an application that starts some action when the user clicks on a specified button of a third-party windows application. I have already read here: Global mouse capture in C# application so I am able to detect when an application is…
Mark85
  • 61
  • 1
  • 1
  • 5
3
votes
1 answer

How to get mouse movement information when cursor is off-screen

[please see update at the end] I'm an old stack overflow user (as most developers on, you know, Earth), but that's my first question here. I'm trying to use an "air mouse" for gaming (pointing it to the screen), but as the mouse sensor is a…
FabricioNK
  • 31
  • 3
3
votes
1 answer

C# Is there a way to detect a mouse click from additional mouse buttons with hooks?

I'm currently working on a personal project where I'm trying to create an APM calculator like. In order to realize it I need to be able to detect any key pressed and any mouse click. I'm using hooks to catch keyboard events and mouse events but I…
3
votes
0 answers

How to swallow mouse input while using Raw Input?

Situation: I am working on an overlay application that needs to intercept the input headed to another process and block that input if necessary. Previous Attempts: So far I have created a low level mouse hook that blocks mouse input to some target…
3
votes
6 answers

C#: How do I get the coordinates of my mouse when left/right mouse button has been pressed?

How do I get the coordinates of my mouse when left/right mouse button has been pressed? I am using a low level mouse hook and am able to get the current position of my cursor, but I would like to be able to retrieve the position when any mouse…
Zolomon
  • 9,359
  • 10
  • 36
  • 49
3
votes
1 answer

QT global mouse listener

I'm new to QT from Java. Is there something like this: https://code.google.com/p/jnativehook/ for QT? Can I get all the mouse events with coordinates? I've done the following: bool MainWindow::eventFilter(QObject *obj, QEvent *event) { if…
user754730
  • 1,341
  • 5
  • 31
  • 62
3
votes
1 answer

Closing the window delays if a mouse hook is set

If I set a low level mouse hook, WH_MOUSE_LL, when I click the [x] (Close) button the window delays ~500ms and then it disappears. Do you know what causes the delay? And, is there a way to fix it? (the window and the hook are created with direct…
Nick Dandoulakis
  • 42,588
  • 16
  • 104
  • 136
1
2 3 4 5 6 7