Voice Commands -- Speech Recognition..
I am using the following code:
Code:
Option Explicit
Private Sub DirectSR1_PhraseFinish(ByVal flags As Long, ByVal beginhi As Long, ByVal beginlo As Long, ByVal endhi As Long, ByVal endlo As Long, ByVal Phrase As String, ByVal parsed As String, ByVal results As Long)
'this event fires when directSR comes up with a result
'the word that has been recognised is stored
'in the Phrase argument
Select Case Phrase
Case Is = "red"
MsgBox "you said red"
Case "green"
MsgBox "you said green"
Case Is = "blue"
MsgBox "you said blue"
Case Else
MsgBox "what the?!"
End Select
End Sub
Private Sub Form_Load()
Dim GrammarStr As String
'this is the list of words that directSR will
'recognise
GrammarStr = "[Grammer]" + vbNewLine + _
"type=cfg" + vbNewLine + _
"[<start>]" + vbNewLine + _
"<start>=red" + vbNewLine + _
"<start>=green" + vbNewLine + _
"<start>=blue" + vbNewLine
'load the words to recognise
DirectSR1.GrammarFromString GrammarStr
'start listening
DirectSR1.Listen
End Sub
when I run my app, it doesn't even recognise me saying anything!!
it doens't even bring up the msgbox with WHAT THE?!
what is going wrong??
Thanks,