Getting the current Windows input language and notifications when the language changes

I am writing on the on-screen keyboard. The keyboard works in a separate process, and the application window is on top and does not receive focus. When I switch between applications, the language changes. How can I get the currently selected language in the toolbar and how can I be notified of its change?

The InputLanguageManager and InputLanguage.net classes can only do this for applications in which they are used.

I found that the WM_INPUTLANGCHANGE message is sent when the language changes. But this message is sent only to the focused window.

The osk.exe application on Windows 7 can do this. Please give me some tips on how I achieve this behavior.

+3
source share
2 answers

A quick Google trip gave this result . This seems to indicate that system interceptors are the right way to go.

0
source

Global interceptors work well, but WM_INPUTLANGCHANGE and WM_INPUTLANGCHANGEREQUEST are only sent when the input language is changed by pressing hot keys or on the toolbar. But when you switch between applications with different input languages, the language changes in the toolbar, but Windows messages are not sent.

0
source

Source: https://habr.com/ru/post/1764925/


All Articles