如何将参数传递给 BackGroundWorker
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?
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
How can I pass text2 to vox.speak?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在
cmdSpeak_Click
中,将 text2 作为参数传递给 RunWorkerAsync在
BackgroundWorker1_DoWork
中,检索参数的值In
cmdSpeak_Click
, pass text2 as a parameter to RunWorkerAsyncIn
BackgroundWorker1_DoWork
, retrieve the value of the parameter