You are reading help file online using chmlib.com
|
The following code sample represents a simple, but functional, recognition application. It uses a dictation grammar and allows free dictation. The commented lines refer to hypothetical text boxes in a form to possibly display information. Of course you may modify this application as needed to fit your own requirements.
Before running the application, a speech reference must be included. Using the Project->References menu, find and select the Microsoft Speech Object Library.
Public WithEvents RC As SpSharedRecoContext
Public myGrammar As ISpeechRecoGrammar
Private Sub Form_Load()
Set RC = New SpSharedRecoContext
Set myGrammar = RC.CreateGrammar
myGrammar.DictationSetState SGDSActive
End Sub
Private Sub RC_Recognition(ByVal StreamNumber As Long, ByVal StreamPosition As Variant, ByVal RecognitionType As SpeechLib.SpeechRecognitionType, ByVal Result As SpeechLib.ISpeechRecoResult)
'Label1.Caption = Result.PhraseInfo.GetText
End Sub
Private Sub RC_StartStream(ByVal StreamNumber As Long, ByVal StreamPosition As Variant)
'Label2.Caption = Val(StreamNumber)
End Sub
You are reading help file online using chmlib.com
|