Results 1 to 2 of 2

Thread: mediaplayer1

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2000
    Posts
    77

    Unhappy

    i use mediaplayer to play .wav files but i am listing more then one files in my listbox so what i like to do is when one file is finish playing it will goto the next file in listbox and play that file.

  2. #2
    PowerPoster Chris's Avatar
    Join Date
    Jan 1999
    Location
    K-PAX
    Posts
    3,238
    Hi! amitkhatri, I pressume that all your wav file is locate at a fixed path as "C:\Wav\"

    Code:
    Option Explicit
    Private Idx As Long
    
    Private Sub Command1_Click()
        Idx = 0
        PLAY_WAV_LIST
    End Sub
    
    Private Sub Form_Load()
        LOAD_WAV_LIST
    End Sub
    
    Private Sub LOAD_WAV_LIST()
    Dim f As String
    f = Dir("C:\wav\")
    Do While f <> ""
        List1.AddItem f
        f = Dir()
        DoEvents
    Loop
    End Sub
    
    Private Sub PLAY_WAV_LIST()
        MediaPlayer1.FileName = "C:\Wav\" & List1.List(Idx)
        MediaPlayer1.Play
    End Sub
    
    Private Sub MediaPlayer1_EndOfStream(ByVal Result As Long)
        If Idx <> List1.ListCount - 1 Then
            Idx = Idx + 1
            PLAY_WAV_LIST
        End If
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width