VC6.0 C + + How to invoke the Microsoft Windows System SDK Speech API

Source: Internet
Author: User

Download 3 Voice API installation packages http://www.microsoft.com/en-us/download/details.aspx?id=10121

need to install the Microsoft Voice API installation package: Speechsdk51langpack, SpeechSDK51, and msttss22l,


In order to use this SDK in VC, it is necessary to add the SDK's include and LIB directories in the project, in order to avoid adding directories to each project, the best way is the VC

Option->directoris plus the include and Lib directories of the SDK. The sapi.h Sapi.lib can also be placed directly into the VC6 header file library file

One of the simplest examples

Let's look at an example of getting started:

#include <sapi.h>

#pragma comment (lib, "Ole32.lib")//coinitialize CoCreateInstance need to call Ole32.dll

#pragma comment (lib, "Sapi.lib")//sapi.lib in the Lib directory of the SDK, must be configured correctly

int main (int argc, char* argv[])

{

Ispvoice * Pvoice = NULL;

COM initialization:

if (FAILED (:: CoInitialize (NULL)))

return FALSE;

Get Ispvoice Interface:

HRESULT hr = CoCreateInstance (Clsid_spvoice, NULL, Clsctx_all, Iid_ispvoice, (void * *) &pvoice);

if (SUCCEEDED (HR))

{

hr = Pvoice->speak (L "Hello World", 0, NULL);

Pvoice->release ();

Pvoice = NULL;

}

Don't forget:

:: CoUninitialize ();

return TRUE;

}
 

VC6.0 C + + How to invoke the Microsoft Windows System SDK Speech API

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.