www.pudn.com > speech_test.rar > Form1.frm
VERSION 5.00
Object = "{4E3D9D11-0C63-11D1-8BFB-0060081841DE}#1.0#0"; "Xlisten.dll"
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 4905
ClientLeft = 60
ClientTop = 450
ClientWidth = 6375
LinkTopic = "Form1"
ScaleHeight = 4905
ScaleWidth = 6375
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton Command1
Caption = "read"
Height = 495
Left = 2160
TabIndex = 2
Top = 4200
Width = 1695
End
Begin ACTIVELISTENPROJECTLibCtl.DirectSR DirectSR2
Height = 975
Left = 4920
OleObjectBlob = "Form1.frx":0000
TabIndex = 1
Top = 360
Width = 855
End
Begin VB.TextBox Text1
Height = 735
Left = 600
TabIndex = 0
Top = 360
Width = 1335
End
Begin VB.Shape Shape1
BackStyle = 1 'Opaque
FillColor = &H000000FF&
FillStyle = 0 'Solid
Height = 615
Left = 2880
Shape = 3 'Circle
Top = 2880
Width = 735
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Declare Function ShellExecute Lib "C:\WINDOWS\system32\shell32.dll" _
Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal _
lpOperation As String, ByVal lpFile As String, ByVal _
lpParameters As String, ByVal lpDirectory As String, _
ByVal nShowCmd As Long) As Long
Dim Voice As SpVoice
Private Sub Command1_Click()
If Not Text1.Text = "" Then
Voice.Speak Text1.Text, SVSFlagsAsync
End If
' Return focus to text box
Text1.SetFocus
End Sub
Private Sub DirectSR2_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)
Select Case Phrase
Case "up"
Shape1.Top = Shape1.Top - 100
Case "domn"
Shape1.Top = Shape1.Top + 100
End Select
MsgBox (Phrase)
End Sub
Private Sub Form_Load()
Set Voice = New SpVoice
'Call VTxtAuto.VTxtAuto.Register(Space(1), Space(1))
'VTxtAuto.VTxtAuto.Speed = 170 '设置语速(170 为正常语速,值越小语速越慢)
'Dim strTxt
'strTxt = "控制? "
'On Error GoTo ErrorHandler
' Call VTxtAuto.VTxtAuto.Speak(strTxt, vtxtsp_VERYHIGH + vtxtst_READING)
'MsgBox "OK!"
' End
'ErrorHandler:
'错误处理语句
'End
Dim order As String
'order = "[Grammar]" & vbCrLf & "langid = 1033" & vbCrLf & "type=cfg" & vbCrLf & "[]" & vbCrLf & "=上" & vbCrLf& "=下" & vbCrLf
order = "[Grammar]" & vbCrLf & _
"langid = 1033" & vbCrLf & _
"type=cfg" & vbCrLf & _
"[]" & vbCrLf & _
"=up" & vbCrLf & _
"=down" & vbCrLf
'DirectSR1.GrammarFormString " [Grammer]" + vbNewLine + " type=cgf " + vbNewLine + " []" + vbNewLine + " =开始" + vbNewLine
DirectSR2.GrammarFromString (order)
DirectSR2.Activate
End Sub