2013-11-15 64 views
0

我想在我的應用程序中打開windows sapi火車窗口。如何在c#應用程序中打開sapi火車窗口?

我覺得這個程序的文件路徑是「C:\ Windows \ System32 \ Speech \ SpeechUX \ SpeechUXWiz.exe」。但是當我試圖用dobule打開它時,點擊它就會失敗。我嘗試在我的process.start()方法的應用程序也將呈現。

Process.Start(@"C:\Windows\System32\Speech\SpeechUX\SpeechUXWiz.exe"); 

是否有人知道如何打開它?有沒有一個接口可以在sapi中做到這一點?謝謝!

我的系統是windows7 x64。

回答

3

不要直接啓動進程;命令行的細節依賴於版本(事實上,流程本身可能會因版本而異)。

您可以使用speechlib(SAPI IDispatch兼容的API)開始培訓(使用C#)。看看ISpeechRecognizer::DisplayUI

要使用SpeechLib,添加

using SpeechLib; 

到您的代碼,並添加引用(通過項目/添加引用/ COM)的Microsoft Speech Object Library到您的項目。

然後開始訓練,你就會有一些代碼,看起來像這樣:

static void RunTraining() 
{ 
    SpSharedRecoContext RC = new SpSharedRecoContext(); 
    string Title = "My App's Training"; 
    ISpeechRecognizer spRecog = RC.Recognizer; 
    spRecog.DisplayUI(hWnd, Title, SpeechLib.SpeechStringConstants.SpeechUserTraining, ""); 
} 
+0

非常感謝你。 –

+0

System.Speech命名空間中是否存在相同的方法?謝謝。 –

+0

我找不到「SpeechLib.SpeechUserTraining」。請爲我提供更詳細的示例,謝謝。 –

相關問題