replay sound problem
when i press test then the media file will play and when i press stop and the media file success stop. but when i press second time for the test, then the media file cannot be play. have any idea about it.? below is my coding
Private Sub Test_Click()
Alias = CDBox.FileTitle
If Sound.Text = "Default Start Copy File" Then
PlaySound "C:\My Documents\Sound\type.wav", ByVal 0&, SND_FILENAME Or SND_ASYNC
End If
If Sound.Text = "Default Complete Copy File" Then
PlaySound "C:\My Documents\Sound\chord.WAV", ByVal 0&, SND_FILENAME Or SND_ASYNC
End If
If Sound.Text = "Default Incomplete Copy File" Then
PlaySound "C:\My Documents\Sound\fx3.WAV", ByVal 0&, SND_FILENAME Or SND_ASYNC
End If
If Sound.Text = "Default Stop Copy File" Then
PlaySound "C:\My Documents\Sound\ringin.WAV", ByVal 0&, SND_FILENAME Or SND_ASYNC
End If
If (Sound.Text <> "Default Start Copy File") And _
(Sound.Text <> "Default Complete Copy File") And _
(Sound.Text <> "Default Incomplete Copy File") And _
(Sound.Text <> "Default Stop Copy File") Then
'play midi
R% = mciSendString("OPEN " + CDBox.FileName + " TYPE SEQUENCER ALIAS " + Alias, 0&, 0, 0)
R% = mciSendString("PLAY " + Alias + " FROM 0", 0&, 0, 0)
R% = mciSendString("CLOSE ANIMATION", 0&, 0, 0)
'play midi for 10 secs
t = Timer
Do: DoEvents: Loop Until Timer > t + PlayTime
End If
End Sub
Private Sub Stop_Click()
'stop midi and close it
R% = mciSendString("OPEN " + CDBox.FileName + " TYPE SEQUENCER ALIAS " + Alias, 0&, 0, 0)
R% = mciSendString&("STOP " + Alias, 0&, 0, 0)
R% = mciSendString&("CLOSE ANIMATION", 0&, 0, 0)
End Sub
thank you

