📄 利用mstts技术实现英文朗读.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 2415
ClientLeft = 60
ClientTop = 345
ClientWidth = 4680
LinkTopic = "Form1"
ScaleHeight = 2415
ScaleWidth = 4680
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton Command4
Caption = "Quit"
Height = 315
Left = 3533
TabIndex = 4
Top = 1980
Width = 855
End
Begin VB.CommandButton Command3
Caption = "Pause"
Enabled = 0 'False
Height = 315
Left = 2453
TabIndex = 3
Top = 1980
Width = 855
End
Begin VB.CommandButton Command2
Caption = "Stop"
Enabled = 0 'False
Height = 315
Left = 1373
TabIndex = 2
Top = 1980
Width = 855
End
Begin VB.CommandButton Command1
Caption = "Read"
Height = 315
Left = 293
TabIndex = 1
Top = 1980
Width = 855
End
Begin VB.TextBox Text1
Height = 1695
Left = 120
MultiLine = -1 'True
ScrollBars = 2 'Vertical
TabIndex = 0
Top = 120
Width = 4395
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Declare Function waveOutGetNumDevs Lib "winmm.dll" () As Long
Private Sub Command1_Click()
On Error Resume Next
If Text1.Text = "" Then
Exit Sub
End If
Call VTxtAuto.VTxtAuto.Speak(Trim(Text1.Text), vtxtsp_VERYHIGH + vtxtst_READING)
Command2.Enabled = True
Command3.Enabled = True
End Sub
Private Sub Command2_Click()
Call VTxtAuto.VTxtAuto.StopSpeaking
Command2.Enabled = False
Command3.Enabled = False
End Sub
Private Sub Command3_Click()
If VTxtAuto.VTxtAuto.IsSpeaking Then
Call VTxtAuto.VTxtAuto.AudioPause
Command3.Caption = "Resume"
Else
Call VTxtAuto.VTxtAuto.AudioResume
Command3.Caption = "Pause"
End If
End Sub
Private Sub Command4_Click()
Unload Me
End
End Sub
Private Sub Form_Load()
Dim I As Long
Dim ErrMessage As String
I = waveOutGetNumDevs()
If I <= 0 Then
ErrMessage = "系统无声卡或未安装声卡驱" & Chr(13) & "动程序,请安装好后再试……"
MsgBox ErrMessage, , "错误"
Unload Me
Else
Call VTxtAuto.VTxtAuto.Register(Space(10), Space(10))
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -