本站首页    管理页面    写新日志    退出


«August 2025»
12
3456789
10111213141516
17181920212223
24252627282930
31


公告
暂无公告...

我的分类(专题)

日志更新

最新评论

留言板

链接


Blog信息
blog名称:VFP及Sql Server拙笔
日志总数:46
评论数量:107
留言数量:0
访问次数:432448
建立时间:2005年5月12日




[编程及数据库]VFP读取MP3信息资料
文章收藏,  网上资源,  事件记录,  软件技术,  电脑与网络

老瓷 发表于 2008/1/19 2:01:41

*---------------------------------------------------------------------* 程序: 读取 MP3 信息资料* 设计: 红雨* 调用示例*---------------------------------------------------------------------ClearLocal lcMP3File, laMP3Info(5)Store [] To laMP3InfolcMP3File = [Z:\MPSong\阿杜\离别.mp3]If GetMP3Info( lcMP3File, @laMP3Info )    ? [文件: ] + lcMP3File    ? [歌曲: ] + laMP3Info(1)    ? [歌手: ] + laMP3Info(2)    ? [歌集: ] + laMP3Info(3)    ? [年份: ] + laMP3Info(4)    ? [备注: ] + laMP3Info(5)Else    = MessageBox( [该文件没有包含媒体信息!] )Endif Local lcRetuStr, lnMicLengthlcRetuStr = SendMciString( [Open ]+lcMP3File+[ Alias MICTEMP] )If Left(lcRetuStr,5)=[错误:]    = MessageBox(lcRetuStr, 0+16+0, [打开媒体文件错误])Else    = SendMciString( [Set MICTEMP Time Format MilliSeconds])    && 设置时间格式    lnMicLength = Val(SendMciString( [Status MICTEMP Length] )) && 取媒体长度    = SendMciString( [Close MICTEMP] )    ? [时间: ] + allt(str(lnMicLength))+[ 毫秒]EndifReturn *---------------------------------------------------------------------* 程序: 读取 MP3 信息资料* 设计: 红雨*---------------------------------------------------------------------Function GetMP3Info ( tcMP3File, taMP3Info )    External Array taMP3Info    tcMP3File = iif(Type([tcMP3File])=[C], tcMP3File, [])    If Type([aLen(taMP3Info,1)])#[N]        Dime taMP3Info(5)    Else        If aLen(taMP3Info,1)#5            Dime taMP3Info(5)        Endif    Endif    If File(tcMP3File)        Local lcMP3Str, lnFHand        lnFHand = FOPEN( tcMP3File )        If lnFHand > 0            = FSEEK( lnFHand, -128, 2)            lcMP3Str = FREAD( lnFHand, 127 )            = FCLOSE( lnFHand )            If uppe(subs(lcMP3Str,1,3)) = [TAG]                lcMP3Str = subs(lcMP3Str,4)                taMP3Info(1) = allt(subs(lcMP3Str, 1,30))+chr(0)                taMP3Info(1) = allt( left(taMP3Info(1),at(chr(0),taMP3Info(1))-1) )                taMP3Info(2) = allt(subs(lcMP3Str,31,30))+chr(0)                taMP3Info(2) = allt( left(taMP3Info(2),at(chr(0),taMP3Info(2))-1) )                taMP3Info(3) = allt(subs(lcMP3Str,61,30))+chr(0)                taMP3Info(3) = allt( left(taMP3Info(3),at(chr(0),taMP3Info(3))-1) )                taMP3Info(4) = allt(subs(lcMP3Str,91, 4))+chr(0)                taMP3Info(4) = allt( left(taMP3Info(4),at(chr(0),taMP3Info(4))-1) )                taMP3Info(5) = allt(subs(lcMP3Str,95,30))+chr(0)                taMP3Info(5) = allt( left(taMP3Info(5),at(chr(0),taMP3Info(5))-1) )                Return .T.            Else                Return .F.            Endif        Else            Return .F.        Endif    Else        Return .F.    EndifEndfunc Function SendMciString( tcMCIcmd )    Declare integer mciSendString in WINMM String, String, integer,integer    Declare integer mciGetErrorString in WINMM integer, String, integer    lcRetStr = Space( 80)    lcErrStr = Space(256)    lnRetVal = mciSendString( tcMCIcmd, @lcRetStr, Len(lcRetStr), 0 )    If lnRetVal=0        Retu Trim(Strtran(lcRetStr,chr(0),""))    Else        = mciGetErrorString(lnRetVal,@lcErrStr,Len(lcErrStr))        Retu [错误: ]+Trim(Chrtran(lcErrStr,chr(0),""))    EndifEndfunc


阅读全文(3332) | 回复(0) | 编辑 | 精华
 



发表评论:
昵称:
密码:
主页:
标题:
验证码:  (不区分大小写,请仔细填写,输错需重写评论内容!)



站点首页 | 联系我们 | 博客注册 | 博客登陆

Sponsored By W3CHINA
W3CHINA Blog 0.8 Processed in 0.046 second(s), page refreshed 144758352 times.
《全国人大常委会关于维护互联网安全的决定》  《计算机信息网络国际联网安全保护管理办法》
苏ICP备05006046号