globalmousekeyhook
globalmousekeyhook copied to clipboard
System-wide mouse lag while debugging
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.
Can anyone recommend another hook package? This debug issue makes debugging so unpleasant. Otherwise it's a great library!
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.
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.
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.
Any update regarding this issue?
My friend and I have implemented a thread level mouse hook that wont freeze the mouse. @cstrife1 => https://github.com/macote/Winook
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.