With the magic of good ol' MCI, you can get the song length of any type of media - assuming the CODEC is installed on the Windows System. MP3 is, I think, on everything from Windows 98 and up.
[EDIT]
One major thing I left out in the original post: the filename and/or path has to be enclosed in double quotes when it is send to the winmm.dll. This can be done as follows:
filename$=
chr$(34)+"mymp3.mp3"+
chr$(34)
[/EDIT]
Here ya go - should be a universal function. You can take out or the error checking or modify what happens if there is an error. This is written for DBC but should work in DBPro. The function is the work horse:
rem load the winmm dll
winmm=1
load dll "winmm.dll",winmm
rem the filename of your file
filename$=chr$(34)+"mymp3.mp3"+chr$(34)
rem call the function and get the length in milliseconds
print "ERROR REPORTING DEBUG:"
songlength=get_song_length(winmm,filename$)
print
print "length in ms = "+str$(songlength)
rem convert to minutes/secs
fullmin#=songlength/60000.0
min=int(fullmin#)
sec#=60.0*(fullmin#-min)
result$="0"+str$(min)+" : "+str$(sec#)
print "length in minutes = "+result$
end
function get_song_length(dllnum,filename$)
rem error$
error$=space$(254)
rem open device command
lpszCommand$="open "+filename$+" type MPEGVIDEO alias m1"
result=call dll(dllnum,"mciSendStringA",lpszCommand$,0,0,0)
call dll dllnum,"mciGetErrorStringA",result,error$,200
print error$
info$=space$(254)
result=call dll(dllnum,"mciSendStringA","status m1 length",info$,len(info$)-1,0)
call dll dllnum,"mciGetErrorStringA",result,error$,200
print error$
result=call dll(dllnum,"mciSendStringA","close m1",0,0,0)
call dll dllnum,"mciGetErrorStringA",result,error$,200
print error$
value=int(val(info$))
endfunction value
Enjoy your day.