3
Imports SpeechLib
Public Class Form1
Public vox = CreateObject("sapi.spvoice")
Private Sub cmdSpeak_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdSpeak.Click
Dim text2 As String = "Hello , This is a Text. Hello , This is a Text."
BackgroundWorker1.RunWorkerAsync()
End Sub
Private Sub cmdPause_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdPause.Click
vox.pause()
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim SVEPhoneme As Integer = 64
vox.EventInterests = SVEPhoneme
vox.AlertBoundary = SVEPhoneme
End Sub
Private Sub cmdResume_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdResume.Click
vox.resume()
End Sub
Private Sub BackgroundWorker1_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles BackgroundWorker1.DoWork
vox.Speak(Text, SpeechVoiceSpeakFlags.SVSFlagsAsync)
End Sub
End Class
如何將text2傳遞給vox.speak?如何將參數傳遞給BackGroundWorker
對不起這個愚蠢的問題的價值,但我怎麼添加文本2作爲參數在cmdSpeakClick? –
像這樣'Private Sub cmdSpeak_Click(ByVal sender As System.Object,ByVal e As System.EventArgs,ByVal text2 As String)Handles cmdSpeak.Click' ?? –
用我的線代替你的線'BackgroundWorker1.RunWorkerAsync()''BackgroundWorker1.RunWorkerAsync(text2)' – Jimmy