-1

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.

Ivan.Yu
  • 564
  • 1
  • 4
  • 12
  • I have see someone open the Speech Training window in his application.but i can't open it.how can i do this both in SAPI5.1 and SAPI5.4. Thank you. – Ivan.Yu Nov 16 '13 at 19:51

1 Answers1

-1

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.

Alex Dresko
  • 5,179
  • 3
  • 37
  • 57
  • I tryed this code,but occured a Exception "The system could not find the file specified." Thank you. – Ivan.Yu Nov 16 '13 at 19:22
  • Where does SpeechUXWiz.exe exist on your computer? – Alex Dresko Nov 16 '13 at 20:22
  • in the dir "C:\Windows\System32\Speech\SpeechUX",I traced it the path is right,I don't know why the Exception occured. – Ivan.Yu Nov 17 '13 at 06:15
  • This is extremely version dependent. Please use the [existing APIs](http://stackoverflow.com/a/20028368/175201) to perform user training. – Eric Brown Nov 17 '13 at 07:35
  • Thanks for the down vote, Eric. The author didn't say anything about version dependency and perhaps that doesn't matter to him. – Alex Dresko Nov 17 '13 at 14:58
  • @learnren, if you set a breakpoint on the Process.Start(...) line, what does the debugger say the value is for info.FileName? – Alex Dresko Nov 17 '13 at 15:00
  • @AlexDresko It's extremely unwise to take dependencies on API implementation details. This *will* change in future versions of Windows, and I will shed no tears for anyone who uses this method, rather than the documented APIs. – Eric Brown Nov 18 '13 at 06:33
  • Thank you all,Eric is right.Because my English is poor, I did not read the document well. :) – Ivan.Yu Nov 18 '13 at 14:41