因为要连续播放多个WAV文件,在播放时界面没有反应,想用多线程,但不成功。关键是不知怎么传递参数。
Private Sub Grid2_Click(ByVal Sender As Object, ByVal e As System.EventArgs) Handles Grid2.Click
Dim GBdm As String
Dim iType As Integer
GBdm = Grid2.Cell(Grid2.MouseRow, 5).Text()
iType = MsgBox("你确定要广播-" + Grid2.Cell(Grid2.MouseRow, 4).Text() + "-这条信息吗?", 36, "确定广播?")
If iType = MsgBoxResult.Yes Then
T1 = New Thread(AddressOf Me.CBY_PLAY)
T1.Start()
End If
End Sub
Private Sub CBY_PLAY(ByVal BY As String)
Dim path, GBxx() As String
Dim iType, intX As Integer
path = Application.StartupPath & "\..\wav\"
GBxx = Split(BY, ":")
For intX = 0 To GBxx.Length - 1
sndPlay(path & GBxx(intX) & ".wav", 0)
Next
End Sub
Public Declare Function sndPlay Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal SoundName As String, ByVal Flags As Long) As Long