I need to get the currently selected IME language setting in Windows.
I have found ImmGetConversionStatus(), but it doesn't return the currently selected language.
Though this question was asked a long time ago.. I believe you might have solved it by yourself. :)
Did you try? : If on Windows 7: GetUserDefaultLocaleName Function Syntax:
int GetUserDefaultLocaleName(
__out LPWSTR lpLocaleName,
__in int cchLocaleName
);
lpLocaleName holds the current culture.
Check docs: http://msdn.microsoft.com/en-us/library/dd318136%28VS.85%29.aspx
Just FYI, check these too: http://msdn.microsoft.com/en-us/library/dd318135%28VS.85%29.aspx and also 'support.microsoft.com/kb/193080'
Based on this:
https://stackoverflow.com/a/12954320/964053
...you must do sth like this:
HWND fore = GetForegroundWindow(); // Every window has it's own current language (keyboard layout)
DWORD tpid = GetWindowThreadProcessId(fore, 0);
HKL hKL = GetKeyboardLayout(tpid);
WORD wd;
ToAsciiEx(VirtualKey, ScanCode, KeyState, (LPWORD)&wd, 0, hKL);