www.pudn.com > HMRspeech.rar > SpeechRecognition.h, change:2009-11-04,size:1689b


// SpeechRecognition.h: interface for the CSpeechRecognition class. 
// 
////////////////////////////////////////////////////////////////////// 
 
#if !defined(AFX_SPEECHRECOGNITION_H__A203330E_682F_49CE_8E6B_8A96E56132F4__INCLUDED_) 
#define AFX_SPEECHRECOGNITION_H__A203330E_682F_49CE_8E6B_8A96E56132F4__INCLUDED_ 
 
#if _MSC_VER > 1000 
#pragma once 
#endif // _MSC_VER > 1000 
 
#include <atlbase.h> 
extern CComModule _Module; 
#include <atlcom.h> 
#include <sapi.h> 
#include <sphelper.h> 
#include <spuihelp.h> 
 
/////////////////////////////////////////////////////////////// 
// speech message 
// 
#define WM_SREVENT WM_USER+102 
 
class CSpeechRecognition   
{ 
public: 
	CSpeechRecognition(); 
	virtual ~CSpeechRecognition(); 
 
	// initialize 
	BOOL Initialize(HWND hWnd = NULL, BOOL bIsShared = TRUE); 
	void Destroy(); 
	// start and stop 
	BOOL Start(); 
	BOOL Stop(); 
	BOOL IsDictationOn() 
	{ 
		return m_bOnDictation; 
	} 
	// event handler 
	void GetText(WCHAR **ppszCoMemText, ULONG ulStart = 0, ULONG nlCount = -1); 
	// voice training 
	HRESULT VoiceTraining(HWND hWndParent); 
	// microphone setup 
	HRESULT MicrophoneSetup(HWND hWndParent); 
	// token list 
	HRESULT InitTokenList(HWND hWnd, BOOL bIsComboBox = FALSE); 
	// error string 
	CString GetErrorString() 
	{ 
		return m_sError; 
	} 
	// interface 
	CComPtr<ISpRecognizer> m_cpRecoEngine; // SR engine 
	CComPtr<ISpRecoContext> m_cpRecoCtxt;  // Recognition context for dictation 
	CComPtr<ISpRecoGrammar> m_cpDictationGrammar; // Dictation grammar 
private: 
	CString m_sError; 
	BOOL m_bOnDictation; 
}; 
 
#endif // !defined(AFX_SPEECHRECOGNITION_H__A203330E_682F_49CE_8E6B_8A96E56132F4__INCLUDED_)