COM Objects, C#, and the Microsoft Speech API
By Charles Simon, September 01, 2002
Using COM objects in C# is a snap relative to C++. In this overview of handling events from a COM object, Charles uses the Microsoft Speech API to create a sample program called BackChat that provides both speech recognition and text-to-speech functionality. He also demonstrates using a database table for nonvolatile data storage and how to access the Windows service ShellExecute() to spawn other Windows programs from a .NET program.
September 2002/COM Objects, C#, and the Microsoft Speech API
Listing 5: This event delegate will be called whenever a phrase is recognized.
RecoContext.Recognition += new
SpeechLib._ISpeechRecoContextEvents_RecognitionEventHandler(
this.RecoContext_Recognition);
private void RecoContext_Recognition(int StreamNumber,
object StreamPosition,
SpeechLib.SpeechRecognitionType RecognitionType,
SpeechLib.ISpeechRecoResult Result)
{
//handle the event
}