Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Ouch, FoxPro let me down - duration = 0.00000
Message
De
31/12/2017 20:27:05
Antonio Lopes (En ligne)
BookMARC
Coimbra, Portugal
 
 
À
31/12/2017 19:44:50
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
01656859
Message ID:
01656860
Vues:
99
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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform