2

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.

dsolimano
  • 8,870
  • 3
  • 48
  • 63
kwon
  • 21
  • 3

2 Answers2

2

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'

Ashwin
  • 1,942
  • 4
  • 30
  • 59
  • 1
    thanks, but I want to know current keyboad local(language) info. not default language. I had ImmGetConversionStatus() function. Sorry, my poor english ability. – kwon Jun 28 '11 at 13:50
0

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);
Community
  • 1
  • 1
NoOne
  • 3,851
  • 1
  • 40
  • 47