如何在Visual c++ 2010 Express中设置SAPI
How to setup SAPI with Visual C++ 2010 Express?
我需要知道如何使用visual c++ 2010 express设置SAPI (Windows Speech API)。我知道Windows 7带有内置的SAPI库,我正在使用Windows 7。但是,我下载了SAPI 5.1,以防需要。MS关于在VS中设置SAPI的说明相当旧,这对我不起作用。
我怎么能设置它与VS 2010 Express,因为我需要将这些设置应用到QT和继续我的最后一年的项目。
你知道什么?我从你之前的问题中提取了代码,并删除了ATL的东西(Visual Studio Express 2010不支持ATL)。我留下了这个
#include <windows.h>
#include <sapi.h>
#include <iostream>
using namespace std;
int main(int argc, char* argv[])
{
cout << "Hello" << endl;
ISpVoice * pVoice = NULL;
if (FAILED(::CoInitialize(NULL)))
return FALSE;
HRESULT hr = CoCreateInstance(CLSID_SpVoice, NULL, CLSCTX_ALL, IID_ISpVoice, (void **)&pVoice);
if( SUCCEEDED( hr ) )
{
cout << "Succeeded" << endl;
hr = pVoice->Speak(L"Hello world", 0, NULL);
pVoice->Release();
pVoice = NULL;
}
else
{
cout << "Not succeeded" << endl;
}
::CoUninitialize();
return TRUE;
}
我创建了一个标准的Windows控制台应用程序项目,并使用此代码作为唯一的源文件。编译并运行它,它工作了。它说!用女声演唱
我没有做任何设置。所以很明显这是可行的。我以前从来不知道这个图书馆。
我有Windows 7和vs2010 express.
相关文章:
- 为不同配置设置MSVC_RUNTIME_LIBRARY的正确方法是什么
- 在C++/Linux中设置单调时钟的一些技巧
- 如何在选项卡视图Qt中设置一个新项目,并保存以前的项目
- 嵌套在类中时无法设置成员数据
- 需要帮助设置在C++中使用的Potrace
- 如何在自删除后将对象设置为nullptr
- 将指针设置为"nullptr"并不能防止双重删除?
- 如何在Ubuntu中使用cmake设置qt4
- ld:bind_at_load和-bitcode_bundle(Xcode设置ENABLE_bitcode=YES)不能
- 如何在boost beast http请求中设置http头
- 如何解决gcc编译器优化导致的centos双编译器设置中的分段错误
- 如何将这个C++哈希表转换为动态扩展和收缩,而不是使用硬设置的最大值
- 为什么文件名被设置为一个点,而不是在读取矢量中的文件名时
- 如何在24位SDL_Surface上设置像素的颜色
- std::设置自定义比较器
- 在 Visual Studios Express 2010 上设置根库
- 为手臂设置visual studio express
- 如何在Visual c++ 2010 Express中设置SAPI
- 应用程序的设置图标VS Express 2012 c++
- 在Visual Studio Express 2013中为初学者设置c++