globalmousekeyhook icon indicating copy to clipboard operation
globalmousekeyhook copied to clipboard

System-wide mouse lag while debugging

Open vredez opened this issue 7 years ago • 7 comments

The mouse is lagging system-wide whenever I hit a breakpoint while debugging a project which uses the mouse-hook. Sometimes, the lagging disappears after a few seconds, sometimes it stays.

This renders debugging unbearable in most scenarios.

vredez avatar Jan 26 '17 12:01 vredez

Can anyone recommend another hook package? This debug issue makes debugging so unpleasant. Otherwise it's a great library!

cstrife1 avatar Jun 24 '19 14:06 cstrife1

If you only need to hook mouse events for your application (not the whole system), I found that changing Hook.GlobalEvents() to Hook.AppEvents() solves the mouse lag issue during debugging.

Of course, that somewhat defeats the purpose of the library which can hook global events. But I still find it very useful to hook application-wide events.

Otherwise, I completely echo the comments above. Hooking global events absolutely kills the mouse while debugging, and it even lags quite a bit during normal, UI-heavy operations in your application.

micahmo avatar Jun 24 '19 15:06 micahmo

I am not sure if I understand the problem correctly but in the application, I created, the mouse wasn't lagging. Feel free to try this application and let me know if mouse lags or not (in release/debug mode). I remember calling this code to ensure that the mouse doesn't lag.

zaafar avatar Jun 24 '19 19:06 zaafar

The freezeups occur when your program hits a breakpoint or exception in Visual Studio. Once a breakpoint is hit, the mouse will freeze for 5+ seconds and repeats every time you step to the next line of code.

It doesn't cause any major problems during normal execution of your program.

cstrife1 avatar Jun 25 '19 06:06 cstrife1

Any update regarding this issue?

C1rdec avatar Mar 20 '20 03:03 C1rdec

My friend and I have implemented a thread level mouse hook that wont freeze the mouse. @cstrife1 => https://github.com/macote/Winook

C1rdec avatar May 19 '20 14:05 C1rdec

I didn't have TOO much problem when it was lagging during debugging, but it was also freezing when popping up a MessageBox with buttons, so I basically unhooked kbm before the MessageBox.Show, then rehook after. It's not optimal, but it works, so just throwing that out for anyone can live with this solution.

cstrife1 avatar Jul 12 '21 19:07 cstrife1