简体   繁体   中英

Keyboard input lang. changed when doing Process.Start() from my WF application

I have a C# Windows Forms application where I eventually start another program with

Process.Start()

For all people using my software the new program now starts with English keyboard.

Is there a way to fix that issue?

FYI, the Windows Forms app is only available in English.

I have 2 ideas:

First one is to check ALL of your Project settings and look if you have somewhere set the english keyboard or just english language.

Second idea from here :

1- For better performance, get the machine installed language as follows: C#

public static InputLanguage GetInputLanguageByName(string inputName)  
{  
    foreach (InputLanguage lang in InputLanguage.InstalledInputLanguages)  
    {  
        if (lang.Culture.EnglishName.ToLower().StartsWith(inputName))  
            return lang;  
    }  
    return null;  
} 

2- Set your preferred language at run time: C#

public void SetKeyboardLayout(InputLanguage layout)  
{  
InputLanguage.CurrentInputLanguage = layout;  
} 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM