bfritscher / carnac

A utility to give some insight into how you use your keyboard
http://carnackeys.com/
Microsoft Public License
697 stars 68 forks source link

ensure the mouse hook is disposed on exit #4

Closed gdh1995 closed 7 years ago

gdh1995 commented 7 years ago

If not calling m_GlobalHook.Dispose();, then the program may just be running OnMouseMove when it's to exit. If it runs into this case, an exception is thrown and the mouse hook doesn't return to system correctly, so mouse gets trapped and you can not move it any more - until Windows finds a timeout in seconds and resets mouse.

Also try to unload this hook if possible, mainly for lowest CPU cost (0.2% -> 0%).

bfritscher commented 7 years ago

Thanks!