8

I want to change the input language in WinXP to Spanish, programmatically. Is there an API to support that?

Thanks

3
  • I'm just curious - why do you want to do this? Are you writing a better UI for picking language? Commented May 4, 2009 at 11:33
  • No, I have a scenario where user can add a new language keyboard but the application does not provide him facility to get into control panel. It's an Win Embedded application with only the App UI and nothing else. Commented May 4, 2009 at 11:40
  • I'm kinda looking for the same thing - a programmatic method to change the input locale in a system-wide manner, or to any application I choose... Commented May 4, 2009 at 16:52

3 Answers 3

10

etc.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks Gadu. I noticed that these impact on process level. anything for the system level also?
Nobody knows. Obviously, tray icon can change language systemwide.
1

Not tried myself, according to documentation SetLocaleInfoA (or ...W variant – undecorated alias if relying on UNICODE setting) does the job on system level.

Don't forget to broadcast the WM_SETTINGCHANGE message as documented.

1 Comment

Late reply for late readers...
0

i managed to do it with keyboard events & shortcut assignment.

  1. go to "text services and input language" (that's how it's called windows 7 control panel)
  2. assign keys for the uni-directional language. e.g. "To English", and "To Hebrew". I've chosen Alt-Shift-7 and Alt-Shift-8, because they're rarely used elsewhere.
  3. from your app, send the key combination for the appropriate language, when needed.

Note:

if "your app" is an external utility (I wrote mine in Python), then it must NOT invoke a window, otherwise /your-app/ will steal the focus, and will get the language change. in python I solved it by using a GUI-less pyw script filename. (or invoke the script with pythonw.exe)

this article shows how to send keyboard events in python:

https://python-decompiler.com/article/2012-11/how-to-generate-keyboard-events-in-python

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.