Search code examples
windowskeyboard-layout

Get keyboard language on Windows


I know that I can use the GetKeyboardLayout function in order to retrieve the current keyboard language. However I am still confused on how to use the return value of this function.

Can someone write down a practical example on how to use it, for example, to check if keyboard is set to English language? (I'm using C++)

Thank you in advance.


Solution

  • Found solution!

    HKL KeyboardLayout = GetKeyboardLayout(0);
    if (PRIMARYLANGID(KeyboardLayout) == LANG_ENGLISH)