Bots Fab
Bots Fab

Reputation: 199

how do I extend virtual key codes in the windows API (Win32)?

I want to create a new virtual key code in the windows API that I can assign scan codes to and read with GetKeyState but I cannot find a way to extend the enumeration.

I have tried using "unknown" virtual key codes in sharpkeys but some applications end up registering those virtual keys rendering my bindings obsolete.

https://learn.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes

Upvotes: -5

Views: 875

Answers (2)

Remy Lebeau
Remy Lebeau

Reputation: 597941

You can't define new virtual key codes. They are fixed values defined inside the OS that keyboard drivers must follow. Only Microsoft can define new key codes.

Upvotes: 0

Vlad Feinstein
Vlad Feinstein

Reputation: 11321

Those key codes are just #defines, not an enumeration.

You can define your own, of course. But how do you plan to use them? What would make them a virtual key? Are you writing a keyboard driver?

Upvotes: 0

Related Questions