hi there, I am making an animation which include music. I want my program to stop the animation when the music stops. Anybody know what code do i need to apply through if condition? I need your help... =( tnx.

Here is my code:

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        AxWindowsMediaPlayer1.URL = ("Beyonce - Diva.mp3")
        If AxWindowsMediaPlayer1 = "i dont know what code should I place here" Then
            Timer1.Enabled = False
        End If
    End Sub
4 Years
Discussion Span
Last Post by gujinni

I would suggest that you place your logic in the PlayStateChange event handler. Here is a snippet from a program of mine.

   Sub WMP1_PlayStateChange(ByVal sender As Object, _
         ByVal e As AxWMPLib._WMPOCXEvents_PlayStateChangeEvent) _
         Handles wmp1.PlayStateChange

         Select Case e.newState

            Case WMPLib.WMPPlayState.wmppsUndefined
            currentStateLabel.Text = "Undefined"

            Case WMPLib.WMPPlayState.wmppsStopped
            currentStateLabel.Text = "Stopped"

            Case WMPLib.WMPPlayState.wmppsPaused
            currentStateLabel.Text = "Paused"

            Case WMPLib.WMPPlayState.wmppsPlaying
               currentStateLabel.Text = "Playing"

            Case WMPLib.WMPPlayState.wmppsScanForward
            currentStateLabel.Text = "ScanForward"

            Case WMPLib.WMPPlayState.wmppsScanReverse
            currentStateLabel.Text = "ScanReverse"

            Case WMPLib.WMPPlayState.wmppsBuffering
            currentStateLabel.Text = "Buffering"

            Case WMPLib.WMPPlayState.wmppsWaiting
            currentStateLabel.Text = "Waiting"

            Case WMPLib.WMPPlayState.wmppsMediaEnded
            currentStateLabel.Text = "MediaEnded"

            Case WMPLib.WMPPlayState.wmppsTransitioning
            currentStateLabel.Text = "Transitioning"

            Case WMPLib.WMPPlayState.wmppsReady
            currentStateLabel.Text = "Ready"

            Case WMPLib.WMPPlayState.wmppsReconnecting
            currentStateLabel.Text = "Reconnecting"

            Case WMPLib.WMPPlayState.wmppsLast
            currentStateLabel.Text = "Last"

            Case Else
            currentStateLabel.Text = ("Unknown State: " + e.newState.ToString())

         End Select
   End Sub

Ok. thanks. This codes help me a lot.

Edited by gujinni: Wrong reply

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.