On some occasions, you may want to get a "global" input language - that is, the keyboard layout used by the current foreground window\application\whatever. Basically, simulating the behaviour of the language panel on Windows.
The common use cases are on-screen keyboards, fullscreen applications, and widgets.
While I wasn't able to find a premade function that get this particular thing during my searches, it turned out not to be too hard to assemble:
Some code that I made to test how (and if) getting joystick\gamepad state via winmm would work in C#.
Contains required structs, functions, and fallback to joyGetPos if joyGetPosEx does not work for some reason.
Continue reading →