Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

calling keyboard.send() with a scan code produces wrong output #649

Open
ddrowley opened this issue Jun 27, 2024 · 0 comments
Open

calling keyboard.send() with a scan code produces wrong output #649

ddrowley opened this issue Jun 27, 2024 · 0 comments

Comments

@ddrowley
Copy link

I have a program that is basically just waiting for a keypress and then passing the scan code through to keyboard.send() (running on Windows with a standard US keyboard layout), but it's outputting incorrect characters. For example, pressing the semicolon key (;) produces scan code 39, but keyboard.send(39) outputs a grave (`) character.

The core issue seems to be that the calls to MapVirtualKeyExW() (in _setup_name_tables()) are producing incorrect mappings. In _setup_name_tables(), the semicolon (name == ';') is being mapped to these entries: [(26, 186, ...), (39, 192, ...)]. I think the correct scan code for semicolon is 39, and the correct vk is 186, so the scancode->vk mapping (which is output from MapVirtualKeyExW) is incorrect - it seems to be mixed up with the scan code and vk for the grave key (26 and 192, respectively). Any idea why it's outputting an incorrect mapping, or how to fix it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant