C# Winforms - Get and update current keyboard language in background

68 Views Asked by At

I want to make a function that gets the current keyboard language of the user, while it is running in the background (form is hidden). I've tried to use InputLanguage.CurrentInputLanguage.Culture.Name but for some reason it doesn't work properly in threads - it doesn't update after the user is switching between languages. I tried a lot of different approaches such as using timers, but everything that use any form of threads just don't work.

I also noticed a strange behavior - when I create a MessageBox after getting the current language, it magically updates.

Can someone help or explain to me what should I do?

(English isn't my native language so I'm sorry if this post isn't very clear).

0

There are 0 best solutions below