Controle de WindowsMediaPlayer1
bonjour,
je cherche à faire une sorte de blind test sous excel sur un userform. pour cela, j'ai ajouté ceci dans le userform correspondant:
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
| Private Sub UserForm_Activate()
'playlist
Dim Xwmp As IWMPMedia
WindowsMediaPlayer1.currentPlaylist.Clear
Set Xwmp = WindowsMediaPlayer1.newMedia("H:\***.mp3")
WindowsMediaPlayer1.currentPlaylist.insertItem 0, Xwmp
Set Xwmp = WindowsMediaPlayer1.newMedia("H:\***.mp3")
WindowsMediaPlayer1.currentPlaylist.insertItem 1, Xwmp
Set Xwmp = WindowsMediaPlayer1.newMedia("H:\***.mp3")
WindowsMediaPlayer1.currentPlaylist.insertItem 2, Xwmp
'Lecture
Dim maRéponse1 As Integer
maRéponse1 = MsgBox("Prêt à jouer ?", vbYesNo)
If maRéponse1 = vbYes Then
WindowsMediaPlayer1.Controls.Play
Else
Unload Me
UserForm2.Show
End If
'chrono (voir module1)
Line1: StartTimer
MsgBox (("Artiste: ") & WindowsMediaPlayer1.currentMedia.getItemInfo("author") & Chr(10) & ("Titre: ") & WindowsMediaPlayer1.currentMedia.getItemInfo("Title"))
WindowsMediaPlayer1.Controls.Stop
If WindowsMediaPlayer1 Is Nothing Then
Exit Sub
Else:
MsgBox ("Attention... la prochaine chanson va commencer !")
WindowsMediaPlayer1.Controls.Next
WindowsMediaPlayer1.Controls.Play
StopTimer
GoTo Line1
End If
End Sub |
et un chrono dans le module1:
Code:
1 2 3 4 5 6 7
| Sub StartTimer()
PauseTime = 30
Start = Timer
Do While Timer < Start + PauseTime
DoEvents
Loop
End Sub |
les 3 chansons de la playlist se lancent bien durant 30sec puis se stoppent pr passer à la suivante, seulement je voudrais qu'a la fin de la dernière chanson windowsmediaplayer s'arrete. il doit y avoir une histoire de boucle mais je n'arrive pas a stopper et les 3 chansons n'arretent pas de tourner en boucle une par une. en fait, a la fin de la 3eme chanson, la 1ere repart alors que je voudrais que tout s'arrete.
merci de votre aide.
a bientot,
mickael