samedi 31 janvier 2015

Detecting if music has ended in VB.NET

Title says it all - I'm in VB.NET and using Windows Media Player as a base for a music player I'm making. I've got the following code to detect if a currently playing .mp3 file has ended:



'Checks to see if the player is still playing music
While WMPLib.WMPPlayState.wmppsPlaying
If WMPLib.WMPPlayState.wmppsMediaEnded Then
MessageBox.Show("Playing next song")
End If
End While


The while check can successfully see that a music file is being played, however the IF statement doesn't detected when a music file has ended, it actually returns true whilst the media is currently playing. How can I get it to detect when a music file has finished playing?


Aucun commentaire:

Enregistrer un commentaire