I want get active language keyboard
for get active language i use this function :
WCHAR name[256];
GUITHREADINFO Gti;
::ZeroMemory(&Gti, sizeof(GUITHREADINFO));
Gti.cbSize = sizeof(GUITHREADINFO);
::GetGUIThreadInfo(0, &Gti);
DWORD dwThread = ::GetWindowThreadProcessId(Gti.hwndActive, 0);
HKL lang = ::GetKeyboardLayout(dwThread);
LANGID language = (LANGID)(((UINT)lang) & 0x0000FFFF); // bottom 16 bit of HKL is LANGID
LCID locale = MAKELCID(language, SORT_DEFAULT);
GetLocaleInfo(locale, LOCALE_SLANGUAGE, name, 256);
return CString(name);
but this function retrieve One last with the last change (not new language), but i want to get new language, what is problem? what is wrong?