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
0
votes
0 answers

How can I get a relative position to my Canvas when the mouse is outside of the application Window in WPF

public MainWindow() { InitializeComponent(); _hook = Hook.GlobalEvents(); _hook.MouseMove += DrawMouseMove; } private void DrawMouseMove(object sender, System.Windows.Forms.MouseEventArgs e) { Point GetMousePos() =>…
itsncnt
  • 15
  • 4
0
votes
2 answers

WW_MOUSE_LL hook doesnt get called

Im currently creating a AFKChecker for my application. The problem is that the low level mouse hook doesnt get called. I have checked if it returns 0 which it doesnt. So the keyboard hook works but not the mouse hook. I have googled, but I have…
BlackVoid
  • 627
  • 1
  • 6
  • 21
0
votes
0 answers

WM_MOUSEWHEEL doesn't seem to be _always_ generated, what gives?

First off, what I wanted to accomplish: intercepting (via a low level mouse hook) WM_MOUSEHWHEEL messages to go back and forward in Windows' file explorer history, or at least to the parent window if access to the history weren't possible. That was…
James Russell
  • 339
  • 1
  • 3
  • 12
0
votes
0 answers

Returning 1 from Windows mouse hook makes PC click stop the whole system from working

I have a hook created with these lines (works properly, except for the new return 1 line). What I'm trying to do is disable the right click: if (_keyboardHook == IntPtr.Zero && _mouseHook == IntPtr.Zero) { IntPtr hInstance =…
0
votes
1 answer

What do I put for the MouseDevice parameter in a MouseButtonEventArgs Constructor?

I'm creating an app in WPF c# that needs to be able to detect mouse click up and click down events separately. In order to do this, I use code for a Global Mouse Hook that I found online. the only problem with the code was that it used EventArgs as…
0
votes
1 answer

Java / Transform key from keyboard or mouse to another key

I have a swing Java application (A) that launches another application (B) using Runtime.getRuntime().exec() when a certain button is pressed. Is it possible to set a certain Key Hook so that when the application (B) is open and active, it changes…
Neo
  • 69
  • 7
0
votes
1 answer

Windows API Mousehook , Capture rightmousebutton + Ctrl (WM_RBUTTONDOWN + MK_CONTROL) clicked togather

initially i was able to print something when i pressed only right mouse button using if (wParam == WM_RBUTTONDOWN)but now , i want the same effect, i want to print something when right mouse button + Ctrl key is pressed. how can i acheive that ? i…
yezy
  • 49
  • 6
0
votes
1 answer

Mouse Global Hook - WM_MOUSEMOVE delay

Okay so there are plenty of samples for mouse global hooking. My issue is how can I add a timer/delay for mouse movement. What is the way of doing this? I thought maybe I should Thread.Sleep() on detecting WM_MOUSEMOVE ? if…
normaluser
  • 57
  • 2
  • 7
0
votes
1 answer

how to access ui structures(textboxes,labels) inside static function MouseProc, SetWindowsHookEx?

In my .h file function mouseProc is declared as static(it has to be) .h file static LRESULT CALLBACK mouseProc(int Code, WPARAM wParam, LPARAM lParam); initially i thought i would add &ui as a parameter to this function, but i am not able to do so.…
0
votes
4 answers

How to get notified of mouse/keyboard activity without a global hook?

I have a transparent window (WS_EX_TRANSPARENT) floating topmost. Whenever there is a mouse move (anywhere on the screen) or keyboard stroke, it needs to display the related info (e.g. mouse position). Is it possible to capture mouse/keyboard…
0
votes
1 answer

Global cursor icon changing

I have a button on a (c#) WinForm, and when it is pressed (mouse down then up) I would like to change the mouse cursor to a custom icon. I would like that custom cursor icon to remain regardless of mouse position on the screen area (over source app,…
Exergist
  • 157
  • 12
0
votes
1 answer

Why are Low Level Mouse Hooks Causing Lag

I'm trying to make an application that just detects if the left mouse button is held down. In trying to do this, as well as learn mouse hooks, I copy-pasted a hook from an example source…
0
votes
1 answer

Which messages can be passed to a low-level mouse hook callback function?

So, I was reading the WinApi documentation for the callback function of a low-level mouse hook and I got confused about the WPARAM parameter passed to this function. From the Documentation about the callback function: wParam [in] Type: WPARAM The…
thebear8
  • 194
  • 2
  • 11
0
votes
1 answer

How to Hook Mouse Event in C++ Builder Application using Windows Mouse Hook API Function?

I have a problem hooking mouse event in C++Builder, it's showing an error: [bcc32 Error] MainUnit.cpp(24): E2034 Cannot convert 'long * (__stdcall * (_closure )(int,unsigned int,long))(int,unsigned int,long)' to 'long (__stdcall *)(int,unsigned…
Abdennour
  • 65
  • 1
  • 8
0
votes
2 answers

Hook application with .NET to capture double click events

How can I hook an application so that I can find out when the mouse is double clicked within it? Can this be done in .NET? Are there anythings I should be careful about? (crashing the other application, for instance)
Jason
  • 16,739
  • 23
  • 87
  • 137