JV
2012-10-02 10:30:52 UTC
Hi,
I'm trying to use CreatePhraseFromText() helper method (to build a phrase to give to EmulateRecognition() ) but it fails. I've ran step by step debugging inside and it seems that it fails in the "hr = cpPhrase->InitFromPhrase(&Phrase);" that returns E_INVALIDARG, inside the CreatePhraseFromWordArray() helper.
Could anybody help in fixing that ? (I use the 10.5 SDK)
Here is my code :
const unsigned int maxCharsCnt = 256;
wchar_t wSpokenText[maxCharsCnt];
mbstowcs(wSpokenText, a_strSpokenText, maxCharsCnt);
ISpPhraseBuilder* pPhrase;
HRESULT hr = CreatePhraseFromText(wSpokenText, &pPhrase, m_WinLanguageID);
hr = m_cpRecognizer->EmulateRecognition(pPhrase);
and when InitFromPhrase() fails, the given SPPHRASE has rule->pNextSibling member to NULL and the cbSize doesn't match with the sizeof(Phrase).
I'm trying to use CreatePhraseFromText() helper method (to build a phrase to give to EmulateRecognition() ) but it fails. I've ran step by step debugging inside and it seems that it fails in the "hr = cpPhrase->InitFromPhrase(&Phrase);" that returns E_INVALIDARG, inside the CreatePhraseFromWordArray() helper.
Could anybody help in fixing that ? (I use the 10.5 SDK)
Here is my code :
const unsigned int maxCharsCnt = 256;
wchar_t wSpokenText[maxCharsCnt];
mbstowcs(wSpokenText, a_strSpokenText, maxCharsCnt);
ISpPhraseBuilder* pPhrase;
HRESULT hr = CreatePhraseFromText(wSpokenText, &pPhrase, m_WinLanguageID);
hr = m_cpRecognizer->EmulateRecognition(pPhrase);
and when InitFromPhrase() fails, the given SPPHRASE has rule->pNextSibling member to NULL and the cbSize doesn't match with the sizeof(Phrase).