hi Vb.net masters , i need a way to make my all video files that I saved with my specific folder and loop again the videos after play.
I already have some codes from the basic tutorials of MCISendstring over the internet , but only one video is playing with my folder path I think something wrong with my code :cry: , sorry for my bad english ,any help would be greatly appreciated.
so far this is my code:
Public Class Form1
Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal _
lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As _
Integer, ByVal hwndCallback As Integer) As Integer
Dim filepath As String = "D:\Movielist\*.*"
Dim filename As String = "D:\Movielist\Cronos.wmv"
Dim retVal As Integer
Dim playing As Boolean = False
Private Sub Panel1_SizeChanged(ByVal sender As Object, ByVal e As System.EventArgs)
If playing Then
SizeVideoWindow(Panel1.Size)
End If
End Sub
Private Sub SizeVideoWindow(ByVal maxSize As Size)
Dim ActualMovieSize As Size = getDefaultSize()
Dim AspectRatio As Single = CSng(ActualMovieSize.Width / ActualMovieSize.Height)
Dim iLeft As Integer = 0
Dim iTop As Integer = 0
Dim newWidth As Integer = maxSize.width
Dim newHeight As Integer = CInt(newWidth \ AspectRatio)
If newHeight > maxSize.height Then
newHeight = maxSize.height
newWidth = CInt(newHeight * AspectRatio)
iLeft = (maxSize.Width - newWidth) \ 2
Else
iTop = (maxSize.Height - newHeight) \ 2
End If
mciSendString("put movie window at " & iLeft & " " & iTop & " " & newWidth & " " & newHeight, "", 0, 0)
mciSendString("play movie repeat", "", 0, 0)
Console.ReadLine()
End Sub
Public Function getDefaultSize() As Size
Dim c_Data As String = Space(128)
mciSendString("where movie source", c_Data, 128, 0)
Dim parts() As String = Split(c_Data, " ")
Return New Size(CInt(parts(2)), CInt(parts(3)))
End Function
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
filename = Chr(34) & filename & Chr(34)
retVal = mciSendString("open " & filename & " type mpegvideo alias movie parent " _
& Panel1.Handle.ToInt32 & " style child", "", 0, 0)
retVal = mciSendString("play movie", "", 0, 0)
playing = True
SizeVideoWindow(Panel1.Size)
End Sub
end class
I already have some codes from the basic tutorials of MCISendstring over the internet , but only one video is playing with my folder path I think something wrong with my code :cry: , sorry for my bad english ,any help would be greatly appreciated.
so far this is my code:
Public Class Form1
Private Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" (ByVal _
lpstrCommand As String, ByVal lpstrReturnString As String, ByVal uReturnLength As _
Integer, ByVal hwndCallback As Integer) As Integer
Dim filepath As String = "D:\Movielist\*.*"
Dim filename As String = "D:\Movielist\Cronos.wmv"
Dim retVal As Integer
Dim playing As Boolean = False
Private Sub Panel1_SizeChanged(ByVal sender As Object, ByVal e As System.EventArgs)
If playing Then
SizeVideoWindow(Panel1.Size)
End If
End Sub
Private Sub SizeVideoWindow(ByVal maxSize As Size)
Dim ActualMovieSize As Size = getDefaultSize()
Dim AspectRatio As Single = CSng(ActualMovieSize.Width / ActualMovieSize.Height)
Dim iLeft As Integer = 0
Dim iTop As Integer = 0
Dim newWidth As Integer = maxSize.width
Dim newHeight As Integer = CInt(newWidth \ AspectRatio)
If newHeight > maxSize.height Then
newHeight = maxSize.height
newWidth = CInt(newHeight * AspectRatio)
iLeft = (maxSize.Width - newWidth) \ 2
Else
iTop = (maxSize.Height - newHeight) \ 2
End If
mciSendString("put movie window at " & iLeft & " " & iTop & " " & newWidth & " " & newHeight, "", 0, 0)
mciSendString("play movie repeat", "", 0, 0)
Console.ReadLine()
End Sub
Public Function getDefaultSize() As Size
Dim c_Data As String = Space(128)
mciSendString("where movie source", c_Data, 128, 0)
Dim parts() As String = Split(c_Data, " ")
Return New Size(CInt(parts(2)), CInt(parts(3)))
End Function
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
filename = Chr(34) & filename & Chr(34)
retVal = mciSendString("open " & filename & " type mpegvideo alias movie parent " _
& Panel1.Handle.ToInt32 & " style child", "", 0, 0)
retVal = mciSendString("play movie", "", 0, 0)
playing = True
SizeVideoWindow(Panel1.Size)
End Sub
end class