From: Sa3Q on
Hi.

I want a piece of code (c++ code or c) which will tell me what is
current selected language in windows.

When you have 2-3 languages installed in your Windows, when you change
keyboard layout with shortcut like Alt+shift or with any other method
and press keys and type a word, I want to determine language.

I need global function, not for determining language in current form
or window, I want to determine for example if user is typing in
Notepad with Arabic or Turkish or english language, I want to know
current language which user is typing on or the language id.

Thanks from now!
From: Christian ASTOR on
On 12 nov, 13:04, Sa3Q <s3qs...(a)gmail.com> wrote:

> I want a piece of code (c++ code or c) which will tell me what is
> current selected language in windows.
>
> When you have 2-3 languages installed in your Windows, when you change
> keyboard layout with shortcut like Alt+shift or with any other method
> and press keys and type a word, I want to determine language.

For this, GetKeyboardLayout() ( ITfInputProcessorProfiles also)
From: Sa3Q on
On 12 نوفمبر, 14:24, Christian ASTOR <casto....(a)club-internet.fr>
wrote:
> On 12 nov, 13:04, Sa3Q <s3qs...(a)gmail.com> wrote:
>
> > I want a piece of code (c++ code or c) which will tell me what is
> > current selected language in windows.
>
> > When you have 2-3 languages installed in your Windows, when you change
> > keyboard layout with shortcut like Alt+shift or with any other method
> > and press keys and type a word, I want to determine language.
>
> For this, GetKeyboardLayout() ( ITfInputProcessorProfiles also)
============================
can you give me example
From: Sa3Q on
On 12 نوفمبر, 14:38, Sa3Q <s3qs...(a)gmail.com> wrote:
> On 12 نوفمبر, 14:24, Christian ASTOR <casto....(a)club-internet.fr>
> wrote:> On 12 nov, 13:04, Sa3Q <s3qs...(a)gmail.com> wrote:
>
> > > I want a piece of code (c++ code or c) which will tell me what is
> > > current selected language in windows.
>
> > > When you have 2-3 languages installed in your Windows, when you change
> > > keyboard layout with shortcut like Alt+shift or with any other method
> > > and press keys and type a word, I want to determine language.
>
> > For this, GetKeyboardLayout() ( ITfInputProcessorProfiles also)
>
> ============================
> can  you give me example

====================================================
i use GetKeyboardLayout(0)
but it return only one number
F0280401
please can you explain
From: Christian ASTOR on
On 12 nov, 14:25, Sa3Q <s3qs...(a)gmail.com> wrote:

> i use  GetKeyboardLayout(0)
> but it return only one number
> F0280401
> please can you explain

0 is for current thread...
You can do, in a timer or a worker thread :

HWND hWndFW = GetForegroundWindow();
DWORD dwThreadId = GetWindowThreadProcessId(hWndFW, NULL);
HKL h = GetKeyboardLayout(dwThreadId);
LANGID langid = LANGID(LOWORD(HandleToLong(h)));