MediaPlayer1->DeviceType=dtAutoSelect;  
MediaPlayer1->FileName=ExtractFilePath(Application->ExeName)+"music\\trunk_queue1.wav";
   MediaPlayer1->Open();
   MediaPlayer1->TimeFormat=tfHMS ;
      iLen=MediaPlayer1->Length;
     Label3->Caption=IntToStr(LOBYTE(HIWORD(iLen)));
   Label2->Caption=IntToStr(HIBYTE(HIWORD(iLen)));
   Label4->Caption=IntToStr(HIBYTE(LOWORD(iLen)));
    Label1->Caption=IntToStr(LOBYTE(LOWORD(iLen)));时间秒钟会出现比60大的情况,而且与其他播放器播放的时间相差比较大,我播放的是mp3和wav格式的文件。
这方面的资料也没有找到,请各位帮忙啊!!!

解决方案 »

  1.   

    function Time(TheLength:LongInt):string;
      minute,second:Longint;
      L:string;
    begin
         minute :=TheLength mod 3600000;
         second:=minute mod 60000;
         L :=Inttostr(TheLength div 3600000)+ ':';
         L :=L +Inttostr(minute div 60000) +':';
         if second mod 1000 >=500 then
            second:=(second div 1000)+1
         else
            second:=second div 1000;
         L:= L+IntToStr(second);
         result:=L;
    end;Label1.Caption:=time(ilen);