I need a function that will get the duration of a given file in this format: "00:00", the function has to support as many file types as possible and return the data as String.
Thanx in advance for your help. RED
Printable View
I need a function that will get the duration of a given file in this format: "00:00", the function has to support as many file types as possible and return the data as String.
Thanx in advance for your help. RED
What do you mean by 'Get the duration of a file'?
Get its length
VB Code:
Private Sub Command1_Click() Dim ret As Double, Mint As Integer, Sec As Integer MediaPlayer1.FileName = "C:\WINDOWS.000\MEDIA\Mozart's Symphony No. 40.rmi" ret = MediaPlayer1.Duration Mint = CInt(ret / 60) Sec = ret Mod 60 If Len(Sec) > 1 Then Debug.Print Mint & ":0" & Sec Else Debug.Print Mint & ":" & Sec End If End Sub
of course works only for media player supported formats
:)
without WMP please
:rolleyes:
Visit http://www.wotsit.org, read the file headers for all the formats you need and calculate the duration.