我的表单:
此行中的错误:
REC.LoadGrammar(New Grammar(VOCABULARIO))
???????
谢谢。
Imports System.Speech.Recognition
Imports System.Threading
Imports System.Globalization
Public Class Form1
Dim REC As New SpeechRecognitionEngine
Dim PALABRA As String
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Thread.CurrentThread.CurrentCulture = New CultureInfo("pt-BR")
REC.RequestRecognizerUpdate()
REC.SetInputToDefaultAudioDevice()
Dim VOCABULARIO As New GrammarBuilder
VOCABULARIO.Append(New Choices("cc", "web", "word", "paint"))
REC.LoadGrammar(New Grammar(VOCABULARIO))
REC.RecognizeAsync(RecognizeMode.Multiple)
AddHandler REC.SpeechRecognized, AddressOf RECONOCE
AddHandler REC.SpeechRecognitionRejected, AddressOf NORECONOCE
End Sub
Public Sub RECONOCE(ByVal sender As Object, ByVal e As SpeechRecognizedEventArgs)
Dim RESULTADO As RecognitionResult = e.Result
Label1.Text = RESULTADO.Text.ToUpper
Dim PROCESO As New Process
Select Case RESULTADO.Text
Case "cc"
PROCESO.StartInfo.FileName = "C:\Program Files (x86)\Adobe\Adobe Dreamweaver CC 2014\Dreamweaver.exe"
PROCESO.Start()
Case "web"
PROCESO.StartInfo.FileName = "C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"
PROCESO.Start()
Case "word"
PROCESO.StartInfo.FileName = "C:\Program Files\Windows NT\Accessories\wordpad.exe"
PROCESO.Start()
Case "paint"
PROCESO.StartInfo.FileName = "C:\Windows\System32/mspaint.exe"
PROCESO.Start()
End Select
End Sub
Public Sub NORECONOCE()
Label1.Text = "Repita, por favor!"
End Sub
End Class