jasonpang / Interceptor

C# wrapper for a Windows keyboard driver. Can simulate keystrokes and mouse clicks in protected areas like the Windows logon screen (and yes, even in games). Wrapping http://oblita.com/Interception
MIT License
286 stars 84 forks source link

When Mouse Filter is set to all, The physical mouse begins acting weird. Possibly because Interceptor thread does not terminate properly. #20

Open Jamisco opened 3 years ago

Jamisco commented 3 years ago

I have a problem where, when I set the mouse filter to All, the mouse begins to act up in really weird ways.

For example, even after I closed my program. It is as though the Interceptor is still intercepting the mouse inputs. When I try to click on a button, the click is not detected by windows, or a control that would be say highlighted if the mouse came over it, would not be highlighted if the mouse came over it.

The only way to bring the mouse back to normal is to completely restart the computer.

I did a little bit of digging and I suspect that one of the reasons why this problem might occur is because the thread become hostile and cannot terminate properly.

If you look at the Unload() method, these lines

            callbackThread.Abort(); // This line is not guaranteed to safely abort the thread
            MouseFilterMode = MouseFilterMode.None;
            KeyboardFilterMode = KeyboardFilterMode.None;

            InterceptionDriver.DestroyContext(context); // I also suspect this does not work as it should
            IsLoaded = false;

If anyone knows the problem Im talking about and how to solve it, please let me know.

Thanks