Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Ouch, FoxPro let me down - duration = 0.00000
Message
From
31/12/2017 20:27:05
 
 
To
31/12/2017 19:44:50
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
01656859
Message ID:
01656860
Views:
96
Taking your code, and using WMPlayer.OCX, instead.
*********************************************************
**********************************************************CODE
**********************************************************
select 0
create cursor qsongs (name varchar(100),folder varchar(100),duration b(2))

private poMediaPlayer
poMediaPlayer = CreateObject("WMPlayer.OCX")

process(GETDIR("", "Audio", "Select", 64))

release poMediaPlayer

******************************
******************************Process
******************************
procedure process
lparameters tcFolderName

local laDir[1]
local ii

adir(laDir,addbs(tcFolderName) + '*.*','D')

for ii = 1 to alen(laDir,1)
if laDir[m.ii,1] == '.' or laDir[m.ii,1] == '..'
loop
endif

if atc('D',laDir[m.ii,5]) > 0
process(addbs(tcFolderName) + laDir[m.ii,1])
endif

if inlist(justext(laDir[m.ii,1]),'WMA','MP3','FLAC')
processFile(tcFolderName, laDir[m.ii,1])
endif
next

endproc
******************************
******************************ProcessFile
******************************
procedure processFile
lparameters tcFolderName, tcFileName

local lnSeconds

Items = poMediaPlayer.MediaCollection
m.Item = m.Items.Add(addbs(tcFolderName) + tcFileName) 
? m.Item.getItemInfo("Title"), "by", m.Item.getItemInfo("Artist")

lnSeconds = m.Item.Duration

?'****', m.tcFileName, lnSeconds

insert into qsongs (name, folder, duration) values (tcFileName, tcFolderName, lnSeconds)

endproc 	
----------------------------------
António Tavares Lopes
Previous
Reply
Map
View

Click here to load this message in the networking platform