0

I'm writing a windows installer for an application that depends on spanish input language being enabled which is not default on Windows 7. Is there a way I can programatically detect if Spanish input language is enabled on the host machine running Win 7 and enable it if it's not?

2 Answers2

0

You may read the default or set as default a language through Windows registry, here is the link to the key and the language codes: http://www.windowsitpro.com/article/configuration/where-in-the-registry-is-the-language-setting-for-each-user-stored-

If for example you wish to use python to set the registry here is an example:

            from _winreg import *

            print r"*** Reading from SOFTWARE\Microsoft\Windows\CurrentVersion\Run ***"
            aReg = ConnectRegistry(None,HKEY_LOCAL_MACHINE)

            aKey = OpenKey(aReg, r"SOFTWARE\Microsoft\Windows\CurrentVersion\Run") 
            for i in range(1024):                                           
                try:
                    n,v,t = EnumValue(aKey,i)
                    print i, n, v, t
                except EnvironmentError:                                               
                    print "You have",i," tasks starting at logon..."
                    break          
            CloseKey(aKey)                                                  

            print r"*** Writing to SOFTWARE\Microsoft\Windows\CurrentVersion\Run ***"
            aKey = OpenKey(aReg, r"SOFTWARE\Microsoft\Windows\CurrentVersion\Run", 0, KEY_WRITE)
            try:   
               SetValueEx(aKey,"MyNewKey",0, REG_SZ, r"c:\winnt\explorer.exe") 
            except EnvironmentError:                                          
                print "Encountered problems writing into the Registry..."
            CloseKey(aKey)

            CloseKey(aReg)    
Michael
  • 2,827
  • 4
  • 30
  • 47
0

This Resource Might Help You :

http://msdn.microsoft.com/en-us/library/system.windows.forms.inputlanguage(v=vs.71).aspx

Vikram
  • 309
  • 3
  • 6
  • 19
  • Note that link-only answers are discouraged, SO answers should be the end-point of a search for a solution (vs. yet another stopover of references, which tend to get stale over time). Please consider adding a stand-alone synopsis here, keeping the link as a reference. – kleopatra Jul 21 '13 at 17:14
  • I would definitely give 'end-point' answer If question will be more specific & shown some research already. – Vikram Jul 21 '13 at 18:01