не работает
- Код: Выделить всё
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)
Text1.Text = Phrase
End Sub
Private Sub Form_Load()
DirectSR1.GrammarFromString "[Grammar]" + vbNewLine + _
"type=cfg" + vbNewLine + _
"[<start>]" + vbNewLine + _
"<start>=red" + vbNewLine + _
"<start>=blue" + vbNewLine + _
"<start>=green" + vbNewLine
DirectSR1.Activate
End Sub
и это пробовал
- Код: Выделить всё
Private Sub Command1_Click()
Select Case onoff.Caption
Case Is = "Disable"
DirectSR1.Deactivate onoff.Caption = "Enable"
Label1 = "Disabled"
Case Is = "Enable"
DirectSR1.ActivateAndAssignWindow Command3.Caption = "Disable"
Label1 = "Ready"
End Select
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)
Dim sFile As String
Dim noth As Long
Select Case Phrase
Case "Notepad"
sFile = "\system32\notepad.exe"
noth = ShellExecute(0, "OPEN", _
Environ("SystemRoot") & sFile, "", "", 1)
Case "Volume"
sFile = "\system32\sndvol32.exe"
noth = ShellExecute(0, "OPEN", _
Environ("SystemRoot") & sFile, "", "", 1)
'Case "Media Player"
'sFile = "C:\Program Files\Windows Media Player\mplayer2.exe"
'noth = ShellExecute(0, "OPEN", _ sFile, "", "", 1)
End Select
If Phrase <> "" Then
Label1.Caption = "Matched word is " & Phrase
Else: Label1.Caption = "No word matched"
End If
End Sub
Private Sub Form_Load()
Dim totaldata As String
totaldata = totaldata & "=Notepad" & vbCrLf _
& "=Volume" & vbCrLf & "=Media Player" & vbCrLf
DirectSR1.GrammarFromString (totaldata)
DirectSR1.Activate
End Sub
у кого получилось, выставите исходник или пришлите на мыло strateg2001@inbox.ru буду очень благодарен