Interceptor icon indicating copy to clipboard operation
Interceptor copied to clipboard

Cant send Keys and input.SendKey does right click

Open fleeasura123 opened this issue 4 years ago • 2 comments

Hi, this is my code. When I try SendKey it right clicks.

            Input input = new Input();
            input.KeyboardFilterMode = KeyboardFilterMode.All;
            input.MouseFilterMode = MouseFilterMode.All;
            input.Load();

            Thread.Sleep(2000);

            input.SendLeftClick();

            Thread.Sleep(2000);

            input.KeyPressDelay = 10;
            input.SendKey(Interceptor.Keys.C, KeyState.Down);
            Thread.Sleep(100);
            input.SendKey(Interceptor.Keys.C, KeyState.Up);

            input.SendKeys(Interceptor.Keys.A);

            input.Unload();

fleeasura123 avatar Jan 29 '21 21:01 fleeasura123

It's the Mouse Filter, It is bugged, like really bad.

Set the mouse filter to none and try again. I found out that if you set the mousefiltermode to all, the program starts an unstoppable thread... and fucks your mouse to the point where you need to restart your computer

Jamisco avatar Feb 03 '21 07:02 Jamisco

SendKey is not working due to it sending to the wrong device. SendKey sends it to whatever the last deviceId is. You send more mouse input than keyboard input so this is why it right click. My Pull #23 fixes this. I also fixed the unkillable thread. This is due to the use of Thread.Abort() being expected to always kill the thread. The truth is that it try's to kill the thread. This is even noted in https://docs.microsoft.com/en-us/dotnet/api/system.threading.thread.abort?view=net-5.0 "Calling this method usually terminates the thread."

kevinf100 avatar Jul 14 '21 21:07 kevinf100