Torna al Thread

Option Explicit Public ComandoVoce As DirectSR Public Voce As DirectSS Private Sub Form_Load() Dim Engine, Voice As Long On Error GoTo ErrorMessage Set ComandoVoce = New DirectSR Set Voce = New DirectSS ComandoVoce.Select 1 ComandoVoce.GrammarFromFile "[Grammar]" + vbNewLine + "type=cfg" + vbNewLine + "[<Start>]" + _ vbNewLine + "<start>=dormire" + vbNewLine + "<start>=salve" + vbNewLine ComandoVoce.Initialized = 1 ComandoVoce.Listen ComandoVoce.Activate Voce.Select 1 GoTo NoError ErrorMessage: MsgBox "Impossibile inizializzare il modulo di riconoscimento vocale." & _ vbCrLf & "Assicurarsi che un modulo di riconoscimento vocale sia installato." End NoError: End Sub Private Sub ComandoVoce_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 = "") Then MsgBox "Cosa???" Else Select Case Phrase Case "salve" Voce.Speak "tutto ok" ComandoVoce.Deactivate Case "dormire" Voce.Speak "io vado a dormire" ComandoVoce.Deactivate End Select End If End Sub Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer) ComandoVoce.Deactivate End Sub
Copyright © dotNetHell.it 2002-2024
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5