how to play next movie or mp3 automatically?
nothing happens on EndOfStream event.
Please see attached file.
any help?
Codes
nothing happens on EndOfStream event.
Please see attached file.
any help?
Codes
Code:
Dim file_Path As String
Dim lItem As ListItem
Dim preLoad As String
Dim pPosition As Long
Dim clipTime As String
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Form_Activate()
While wmp.openState <> wmposMediaOpen ' wait for wmp to open
DoEvents
Wend
playTime.Enabled = True
clipTime = wmp.currentMedia.durationString ' Clip Time
Sleep 400
Do
DoEvents
Loop Until wmp.Status <> "Playing"
End Sub
Private Sub Form_Load()
Call existLocation
End Sub
Private Sub cmdBrowse_Click()
Dim sFilePath As String
Dim iPtr As Integer
With dlgBrowse
.InitDir = "C:\"
.Filter = "Folders|Folders|*.."
.FileName = "Browse Folder"
.ShowSave
End With
sFilePath = dlgBrowse.FileName
iPtr = InStr(sFilePath, "\Browse Folder")
If iPtr > 0 Then
sFilePath = Left$(sFilePath, iPtr)
Else
sFilePath = ""
End If
file_Path = sFilePath ' File location
Call WriteINI("HEADER", "1", file_Path, (App.path & "\setup.ini")) ' Create ini file
lstPlaylist.Clear
Call Load_MediaFiles(file_Path)
End Sub
Public Sub Load_MediaFiles(ByVal path As String)
Dim FileName As String
If Right(path, 1) <> "\" Then path = path & "\" Else path = path
'''''''''''LOADING STANDARD VIDEO CD FILES
FileName = Dir(path & "*.dat")
Do Until FileName = ""
lstPlaylist.AddItem FileName
FileName = Dir()
Randomize
Loop
'''''''''''LOADING WINDOWS VIDEO CLIPS
FileName = Dir(path & "*.avi")
Do Until FileName = ""
lstPlaylist.AddItem FileName
FileName = Dir()
Randomize
Loop
'''''''''''''LOADING WINDOWS MOVIE FILES
FileName = Dir(path & "*.mpg")
Do Until FileName = ""
lstPlaylist.AddItem FileName
FileName = Dir()
Randomize
Loop
End Sub
Private Sub existLocation()
Dim strFilePath
strFilePath = App.path & "\setup.ini"
lstPlaylist.Clear
If (Dir(strFilePath) <> "") Then
file_Path = (ReadINI("HEADER", "1", App.path & "\setup.ini"))
Call Load_MediaFiles(file_Path)
End If
End Sub
Private Sub MoveTONext()
If lstPlaylist.ListIndex < lstPlaylist.ListCount - 1 Then
lstPlaylist.ListIndex = lstPlaylist.ListIndex + 1
Else
lstPlaylist.ListIndex = 0
End If
Call playVideo
End Sub
Private Sub playVideo()
On Error Resume Next
sel_file_path = file_Path
If Right(sel_file_path, 1) <> "\" Then
sel_file_path = sel_file_path & "\"
Else
sel_file_path = sel_file_path
End If
sel_file = lstPlaylist.Text
If Dir(sel_file_path & lstPlaylist.Text) <> "" Then
wmp.URL = sel_file_path & lstPlaylist.Text
wmp.Controls.play
Else
MsgBox Chr(34) & lstPlaylist.Text & Chr(34) & " doesn't exist." & vbCrLf & _
"Please verify its location and try again...", vbExclamation, "Error Opening File"
lstPlaylist.Text = sel_file
End If
End Sub
Private Sub lstPlaylist_DblClick()
Call playVideo ' Play Movie
End Sub
Private Sub playTime_Timer()
lblAirTime.Caption = Format(TimeSerial(0, 0, wmp.Controls.currentPosition), "hh:mm:ss")
End Sub
Private Sub wmp_EndOfStream(ByVal Result As Long)
If lstPlaylist.ListIndex = lstPlaylist.ListCount - 1 Then
lstPlaylist.ListIndex = 0
Else
lstPlaylist.ListIndex = lstPlaylist.ListIndex + 1
End If
wmp.URL = file_Path & lstPlaylist.List(lstPlaylist.ListIndex).Text
wmp.Controls.play
End Sub