c++ - GetKeyboardLayout returns strange layout -


getkeyboardlayout(0) seems have decided thread using kind of mixture of lang_german, sublang_german, lang_english , sublang_english_us. i've tried putting in new project, problem persists... here's code i've used test it.

#include <iostream> #include <windows.h> #include <kbd.h>  int main(int argc, char* argv[]) {     std::cout << "keyboard layout id: " << getkeyboardlayout(0) << "\n";     std::cin.ignore(100, '\n');     return 0; } 

that keeps returning 04070409 though don't think should possible. (or it? if yes how construct makelangid?) maps mixture of languages above according msdn. i've tried using loadkeyboardlayout makelangid(lang_german, sublang_german_austrian) standard lang_english, sublang_english (04090409) layout. have read docs wrong , messed something, or what's happening here? i'm out of ideas...

this explained in documentation getkeyboardlayout. i'm surprised missed it, since documentation function return value.

return value

type: hkl

the return value input locale identifier thread. low word contains language identifier input language , high word contains device handle physical layout of keyboard.

04070409 therefore layout us-english language on physical german keyboard.

you cannot make makelangid because makelangid creates language ids, hkl (keyboard layout handle).

it's not clear why care handle's numeric value. nature of handles supposed opaque.


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -