I want to find all the input languages for the keyboard, the ones that you switch between with LEFT ALT + SHIFT.
I can get the default locale and the installed/supported locales with win API but I could not find anywhere anything about the input locales for the keyboard.
You have to use GetKeyboardLayoutList function.
For example, to output in console all keyboard input languages you can use this code:
UINT uLayouts;
HKL *lpList = NULL;
wchar_t szBuf[512];
uLayouts = GetKeyboardLayoutList(0, NULL);
lpList = (HKL*)LocalAlloc(LPTR, (uLayouts * sizeof(HKL)));
uLayouts = GetKeyboardLayoutList(uLayouts, lpList);
for(int i = 0; i < uLayouts; ++i)
{
GetLocaleInfo(MAKELCID(((UINT)lpList[i] & 0xffffffff),
SORT_DEFAULT), LOCALE_SLANGUAGE, szBuf, 512);
wprintf(L"%s\n", szBuf);
memset(szBuf, 0, 512);
}
if(lpList)
LocalFree(lpList);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With