关于speech SDK4.0的DirectSR控件
我使用了speech SDK4.0的DirectSR控件,代码如下:
Dim r As Integer
Private Sub Command1_Click()
DirectSR1.Activate
End Sub
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)
If Phrase = "Run Word" Then
Phrase = ""
Text1.Text = "Word is running"
r = Shell("c;\prigram file\Microsoft office\office\winword.exe")
End If
If Phrase = "Run excel" Then
Text1.Text = "excel is running"
r = Shell("c;\prigram file\Microsoft office\office\excel.exe")
End If
MsgBox ("The command is wrong!")
End Sub
Private Sub Form_Load()
DirectSR1.GrammarFromString ("[Grammar]" + vbNewLine + "type=cfg" + vbNewLine + "[<start>]" + vbNewLine + "<start>+Run Word" + vbNewLine + "<start>=Run Excel" + vbNewLine)
End Sub
可是我无论如何也触发不了PhraseFinish事件,在什么条件下触发PhraseFinish事件,在哪里可以得到DirectSR控件的资料?谢谢。