Sample

Adding voice text is fairly simple. An application has to make only the following modifications:

CoCreateInstance (CLSID_VTxt, NULL, CLSCTX_LOCAL_SERVER, IID_IVoiceText, &pIVoiceText);

Calling CoCreateInstance creates an instance of the voice text object.

pIVoiceText->Register ("", "Demo Application", NULL, IID_IVTxtNotifySink, NULL, NULL);

Applications have to call Register so the voice text knows the name of the application and to what audio device the speech will be played, since some applications will be telephone aware. Also, an application can provide a notification sink so that it's alerted when speaking starts or stops, but this isn't necessary.

The next step is to send out text to be spoken.

pIVoiceText->Speak ("Hello world.", 0, NULL);

Finally, when the application is finished using voice text it releases the object.

pIVoiceText->Release();