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 1: Handling idle time.
//attach the event delegate before calling Speak()
voice.EndStream += new
SpeechLib._ISpeechVoiceEvents_EndStreamEventHandler(this.TTSDone);
//this method will be called when the TTS engine is idle
private void TTSDone (int StreamNumber, object StreamPosition)
{
//do something useful here now that the TTS engine is idle
}