Voice-activated common dialogs crashes

Last reviewed: 11/23/1998

PRB Article ID: P119804

The information in this article applies to:

  • SpeechKit 2.0

Symptoms

Can you provide us with an example showing the use of the AddFileDialog() function? The following sample function crashes when the callback gets a WM_INITDIALOG message.

The only way to avoid the crash is if we avoid speficying the OFN_EXPLORER flag. Is there an incompatibility there?


void CNumberDlg::OnFileButton()
{
	char * fileDialogControls[] = {"cancel","ok"};
	LPOFNHOOKPROC FileSaveDlgHook = NULL;
	OPENFILENAME of;
	
	memset( &of, 0, sizeof( OPENFILENAME ) );
	
AddFileDialog("filedialog",CommandVocabulary,fileDialogControls,2,(long)m_hWnd,(long *)&FileSaveDlgHook);

	of.lStructSize = sizeof( OPENFILENAME );
	of.hwndOwner = m_hWnd;
	of.lpstrFilter = (LPSTR) "*.*";
	of.lpfnHook = (LPOFNHOOKPROC) FileSaveDlgHook;
	of.Flags = OFN_ENABLEHOOK | OFN_EXPLORER;

	GetOpenFileName( &of );
}

Cause

Your code is correct. In fact, OFN_EXPLORER is required. The problem was in the Chant component.

Status

Fixed in 2.0.9.