Search code examples
c#sapi

Open Windows Mictrain by c#


My Code:

private void btnMicTrain_Click(object sender, RoutedEventArgs e)
{          

ProcessStartInfo info = new ProcessStartInfo();
info.FileName = Environment.SystemDirectory+@"\Speech\SpeechUX\SpeechUXWiz.exe";
info.Arguments = "MicTraining";
info.LoadUserProfile=true;
info.UseShellExecute=true;
info.WindowStyle=ProcessWindowStyle.Hidden;

Process.Start(info);
}

but I faild.

And I try it by create a .dat file and open it in my application,and faild too.

thank you.


Solution

  • This works on my system (64 bit, by the way)

    private void btnMicTrain_Click(object sender, RoutedEventArgs e)
    {          
    
    ProcessStartInfo info = new ProcessStartInfo();
    info.FileName = Environment.SystemDirectory+@"\Speech\SpeechUX\SpeechUXWiz.exe";
    info.Arguments = "MicTraining";
    
    Process.Start(info);
    }
    

    Note that, if you've run your existing code already, you may need to make sure shut down all existing SpeechUXWiz.exe instances that are running in the background. Your code to show the window as hidden does indeed start SpeechUXWiz.exe, but it's hidden. And you can't start another instance until you shutdown the first instance.