MediatedCommunications / WindowsInput

Capture and Simulate Keyboard and Mouse Input
MIT License
115 stars 17 forks source link

CurrentThreadKeyboardEventSource cause "Arithmetic operation resulted in an overflow" #25

Closed zhuxb711 closed 1 year ago

zhuxb711 commented 1 year ago

Arithmetic operation resulted in an overflow. image

zhuxb711 commented 1 year ago

Should be here: https://github.com/MediatedCommunications/WindowsInput/blob/9738dd33b298799374fc00bfb462f135c3f13e41/WindowsInput/EventsSources/Keyboard/CurrentThreadKeyboardEventSource.cs#L32

TonyValenti commented 1 year ago

What are you pressing to make that happen?

zhuxb711 commented 1 year ago

I pressed "D" in this scenario. It seems that every key will cause this issue.

Tip: I tested it in Windows App Sdk

TonyValenti commented 1 year ago

Can you give me a link to a GitHub repository that I can use to test? I haven't used it with that SDK in the past.

zhuxb711 commented 1 year ago

Demo for you, thanks! KeyboardTest.zip

TonyValenti commented 1 year ago

Thanks. The current thread hook is seldom used and it looks like there was a nuance with it. I've just published an update.

zhuxb711 commented 1 year ago

Thanks, it's really fast to fix this issue. Very appreciate!

Besides I want to know what is the difference between KeyboardAsync() and Keyword()? Only Global hook have the KeyboardAsync().

TonyValenti commented 1 year ago

It has been a long time since I wrote that code, but I believe the ASYNC version basically runs in its own thread.