I am trying to create a DLL for a Unipaas app. And I need to create a function which will find out which language is set for keyboard and if needed change that language to next one.
I have been looking on many possible solutions but most of them are using Win Forms or WPF:
InputLanguageManager.Current.CurrentInputLanguage
This doesnt work for me because I am not creating any form. I do just call a function.
I did try this:
int language = Thread.CurrentThread.CurrentCulture.KeyboardLayoutId;
but it will give me system language and not keyboard language. There were some other solutions but they were hard for me to understand and implement.
Like here: Change keyboard layout from C# code with .NET 4.5.2
I know that there is GetKeyboardLayout function (winuser.h) in order to retrieve the current keyboard language. However I am still confused on how it works.