Library code snippets
Calculate the duration of a song (Media Player)
By Thom Ass Oles, published on 24 Dec 2001
The code below calculates the length of the track in minutes and seconds from the Windows Media Player properties (which just gives the result in seconds). lblPT is the label used to display the Current Position and total time of Song, in
mm:ss / mm:ss
current position / time remaining
lblPT.Caption = wmp.CurrentPosition \ 60 & ":" & Format(Int(wmp.CurrentPosition Mod 60), "00") & " / " & wmp.SelectionEnd \ 60 & ":" & Format(Int(wmp.SelectionEnd Mod 60), "00")wmp.CurrentPosition gives the location in seconds of the song
wmp.SelectionEnd gives the total seconds of the selected MP3 Song
Related articles
Related discussion
-
Run-time error '91'
by crazyidane (0 replies)
-
Problem handling Redirects with MSXML2.XMLHTTP
by brandoncampbell (2 replies)
-
vbinputbox pauses code while it waits on response. How can I reproduce that?
by brandoncampbell (1 replies)
-
Sending SMS in VB 6
by sirobnole (6 replies)
-
Comboxbox listindex in ActiveX Control
by brandoncampbell (1 replies)
This thread is for discussions of Calculate the duration of a song (Media Player).