#include <windows.h>
#include <sapi.h>
#include <stdio.h>
#include <string.h>
#include <atlbase.h>
#include "sphelper.h"
inline HRESULT BlockForResult(ISpRecoContext * pRecoCtxt, ISpRecoResult ** ppResult)
{
//创建语音识别
HRESULT hr = S_OK;
CSpEvent event;
while (SUCCEEDED(hr) &&
SUCCEEDED(hr = event.GetFrom(pRecoCtxt)) &&
hr == S_FALSE)
{
hr = pRecoCtxt->WaitForNotifyEvent(INFINITE);
}
*ppResult = event.RecoResult();
if (*ppResult)
{
(*ppResult)->AddRef();
}
return hr;
}
const WCHAR * StopWord()
{
const WCHAR * pchStop;
LANGID LangId = ::SpGetUserDefaultUILanguage();
switch (LangId)
{
case MAKELANGID(LANG_JAPANESE, SUBLANG_DEFAULT):
pchStop = L"/x7d42/x4e86///x30b7/x30e5/x30fc/x30ea/x30e7/x30fc//x3057/x3085/x3046/x308a/x3087/x3046";;
break;
default:
pchStop = L"Stop";
break;
}
return pchStop;
}
int _tmain(int argc, TCHAR* argv[])
{
HRESULT hr = E_FAIL;
bool fUseTTS = true; // turn TTS play back on or off
bool fReplay = true; // turn Audio replay on or off
TCHAR szFileName[256];
// Process optional arguments
if (argc > 1)
{
int i;
for (i = 1; i < argc; i++)
{
if (_tcsicmp(argv[i], _T("-noTTS")) == 0)
{
fUseTTS = false;
continue;
}
if (_tcsicmp(argv[i], _T("-noReplay")) == 0)
{
fReplay = false;
&nbs