views:

114

answers:

1

Here's the problem: I have a user with disabilities and using a specialized virtual keyboard. He doesn't have any trouble switching languages in his virtual keyboard, but it doesn't always change the input language (input keyboard?) of the currently-active application - which is exactly what he needs.

So is there any API calls I can do to query a window's current input keyboard? More importantly, is there a way I can externally set another window's input language?

+1  A: 

There is the "InputLanguage" class in System.Windows.Forms (.NET). It allows you to set the desired input language. More information available in MSDN InputLanguage class description.

As for setting the language for a specific window - there is a solution for this:

  1. You should create a program for capturing currently selected window and run it in the background;
  2. When the program is running it captures the names of the programs that the user is currently working on and sets the desired language;

I suggest you go over an example - http://www.java2s.com/Tutorial/CSharp/0520__Windows/GetcurrentActiveWindow.htm - it is the basics you will need to get information about the currently active programs. An example of setting input language is available in the MSDN article.

fixed