Problem Report Bulletins
Last reviewed: 6/30/2005
Article ID: P060505
PRB: MFC application fails in Debug mode when using ViaVoice
The information in this article applies to:
- SpeechKit 4
Symptoms
Running an MFC application in Debug mode fails when using ViaVoice.
Cause
MFC uses an Assert that causes failure if wParam isn't a valid window handle. SMAPI uses wParam to pass sessionID. To avoid crash include the following in your application:
// Add to header ULONG m_smSessionID; virtual BOOL OnCommand(WPARAM wParam, LPARAM lParam); // Add to Application // Add to initilalization code m_smSessionID = 0; // Add OnCommand handler // This is here only for debug compiles. BOOL CRecognitionDlg::OnCommand(WPARAM wParam, LPARAM lParam) { // TODO: Add your specialized code here and/or call the base class if ((m_smSessionID == 0) && (m_pChantSR != NULL)) { m_smSessionID = m_pChantSR->GetNumberProperty(CNPEngineRunning); } if ((wParam > 0) && (wParam == m_smSessionID)) { return TRUE; } return CDialog::OnCommand(wParam, lParam); }
Status
Application change only.
Component Formats Impacted
ActiveX, CDLL, COM