コードはそれほど複雑ではありません。
private
{ Private declarations }
SpSharedRecoContext1 : TSpSharedRecoContext;
fMyGrammar : ISpeechRecoGrammar;
procedure SpSharedRecoContext1Recognition(ASender: TObject; StreamNumber: Integer;
StreamPosition: OleVariant;
RecognitionType: SpeechRecognitionType;
const Result: ISpeechRecoResult);
procedure SpSharedRecoContext1Hypothesis(ASender: TObject; StreamNumber: Integer;
StreamPosition: OleVariant;
const Result: ISpeechRecoResult);
プロシージャTForm1.FormCreate(Sender:TObject); 始める SpSharedRecoContext1:= TSpSharedRecoContext.Create(self); SpSharedRecoContext1.OnHypothesis:= SpSharedRecoContext1Hypothesis; SpSharedRecoContext1.OnRecognition:= SpSharedRecoContext1Recognition; fMyGrammar:= SpSharedRecoContext1.CreateGrammar(0); fMyGrammar.DictationSetState(SGDSActive); 終わり; プロシージャTForm1.SpSharedRecoContext1Recognition(ASender:TObject; StreamNumber:Integer; StreamPosition:OleVariant; RecognitionType:SpeechRecognitionType; const Result:ISpeechRecoResult); 始める Memo1.Text:= Result.PhraseInfo.GetText(0、-1、true); 終わり; プロシージャTForm1.SpSharedRecoContext1Hypothesis(ASender:TObject; StreamNumber:Integer; StreamPosition:OleVariant; const Result:ISpeechRecoResult); 始める Memo1.Text:= Result.PhraseInfo.GetText(0、-1、true); 終わり;
私の問題は、vista-OS音声コマンドが私のプログラムを傍受することでした。「START」と言うと、memo1にstartと書く代わりに、デスクトップのスタートメニューを押します。またはSTARTCANCELEDITDELETESELECTなどのコマンドは助けてください.....私の英語でごめんなさい