mouse-hook

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) ...

Can I suppress selected input before the application's main loop?

As part of my Visual Studio utilities add-in SamTools, I have a mouse input routine that catches Ctrl+MouseWheel and sends a pageup/pagedown command to the active text window. Visual Studio 2010 added a new "feature" that uses that gesture for zoom in/out (barf). Currently, my add-in does send the scrolling command, but Visual Studio sti...

MouseProc hook and WM_LBUTTONDBLCLK

I have a hook setup for getting mouse events in a plugin I develop. I need to get the WM_LBUTTONDBLCLK, and I expect the message flow to be: WM_LBUTTONDOWN, WM_LBUTTONUP, WM_LBUTTONDBLCLK If the I call the next hook when dealing with the first WM_LBUTTONDOWN, then the flow is as expected. However, if I return my own result, then the ex...

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 suppose some specific thing happening in Windows cause the hook to stop, but I can't find ...

Strange behaviour with mouse hook in .net, winforms

I have a form that is displayed, not by ShowDialog, but by setting it's visible property to true. This is so it behaves like a dropdown. The form installs a mouse hook, using SetWindowsHookEx(WH_MOUSE, ...) I detect if the mouse is clicked outside of the dropdown and if so, return 1 in my HookProc method and close the dropdown. The st...

Determine when a mouse hook has handled the last message. Winforms, .Net

I have a form, that acts like a drop-down, that I display non-modal. I attach a mouse hook to the form to determine when the mouse is clicked out of it, so that I know to close it - by setting Visible = False. Because I want the HookProc to handle the last click, I can't dispose the Hook or my Dropdown until I'm sure that my event handl...

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 calls to win32 api in C++) ...

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 button has been pressed. How can I do this? ...

PInvokeStackImbalance - invoking unmanaged code from HookCallback

my goal i want to translate a left click to a right click my approach i register a low-level hook via SetWindowsHookEx (user32.dll) filter left-mouse-clicks check if i want to translate THAT specific click in case that i really want to do not pass on the message create a new mouseclick via mouse_event (user32.dll too) the problem...