Properly detect keyboard layout

Viewed 4660

I have a winforms application where I need to obtain the current keyboard layout of the user. To do that I'm using System.Windows.Forms.InputLanguage.CurrentInputLanguage.LayoutName.

This works fine as long as the user has the form as his active window, once he focuses something else and changes the language the former property wont return a proper value, it will return the last used language while the form was still the active window.

Is there a way I can get the users keyboard layout's name even if he is not focusing the form, there are no restrictions to what can be used.

2 Answers
Related