Thread: SAPI5.1 Text To Speech

  1. #1
    Registered User
    Join Date
    May 2007

    SAPI5.1 Text To Speech

    I'm trying to learn how to use the SAPI5.1 SDK, and I found a small tutorial online, but I can't seem to compile it. I'm using DevC++ and when I try and compile I get an error from the sapi.h file.
    The errors were...

    2 C:\Dev-Cpp\Projects\Test.cpp In file included from Test.cpp
    3536 C:\Program Files\Microsoft Speech SDK 5.1\Include\sapi.h invalid use of undefined type `struct IServiceProvider'
    90 C:\Dev-Cpp\include\ocidl.h forward declaration of `struct IServiceProvider' .
    C:\Dev-Cpp\Projects\ [Build Error] [Test.o] Error 1

    And here is the code I was trying to compile...

    #include <sapi.h>
    ISpVoice* Voice = NULL;				// The voice interface
    int main ( int NumOfArguments, char** Argument )
    	// Initialize COM
    	CoInitialize ( NULL );
    	// Create the voice interface object
    	CoCreateInstance ( CLSID_SpVoice, NULL, CLSCTX_ALL, IID_ISpVoice, (void**)&Voice );
    	// Speak!
    	Voice -> Speak ( L"Hello World!!!", SPF_DEFAULT, NULL );
    	// Shutdown the voice
    	if ( Voice != NULL ) Voice -> Release (); Voice = NULL;
    	// Shutdown COM
    	CoUninitialize ();
    	return 0;
    Examples code would be helpful if necessary and I got this sample code from this website.
    Last edited by brconner; 05-27-2007 at 11:45 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. My text doesn't display
    By joeprogrammer in forum Game Programming
    Replies: 11
    Last Post: 02-23-2006, 10:01 PM
  2. Appending text to an edit control
    By dit6a9 in forum Windows Programming
    Replies: 3
    Last Post: 08-13-2004, 09:52 PM
  3. Text positioning and Text scrolling
    By RealityFusion in forum C++ Programming
    Replies: 3
    Last Post: 08-13-2004, 12:35 AM
  4. Scrolling The Text
    By GaPe in forum C Programming
    Replies: 3
    Last Post: 07-14-2002, 04:33 PM
  5. Replies: 1
    Last Post: 07-13-2002, 05:45 PM