indianakernick / The-Fat-Controller

A library for simulating mouse and keyboard events
Apache License 2.0
38 stars 13 forks source link

I can't figure out how to send 2 keys at once (shift+home) #5

Open bbigras opened 1 year ago

bbigras commented 1 year ago

When I do:

ctx.key_down(tfc::Key::Shift)?;
ctx.key_click(tfc::Key::Home)?;
ctx.key_up(tfc::Key::Shift)?;

It seems I only get the "home" key:

https://user-images.githubusercontent.com/24027/188269238-a9faf951-92f2-409f-8fef-0d37ed64e996.mp4

indianakernick commented 1 year ago

Hi there. Apologies for the delay. I spent some time on this today. I was able to reproduce the problem but I wasn't able to solve it. This is what I found.

So yeah, that's not very useful. I tried switching between virtual key codes and scan codes. I tried introducing a delay. I tried packing all of the keystrokes into a single call to SentInput. Nothing seemed to work. I'm not sure what to do about this.

I'm certainly not an expert in this stuff. Not in the Windows API or Windows in general. For me, Windows is the thing I use to open Steam! So if you're able to find anything on this then please don't hesitate to share it here.