HMSRec=record                    //自定义一个记录类型。用于获取播放文件的时间数据
  HOurs:byte;
 Minutes:byte;
 Seconds:byte;
 NotUsed:byte;
  end;..............
procedure TbrowserForm.Timer1Timer(Sender: TObject);
var l:longInt;
begin
MediaPlayer1.TimeFormat:=tfHMS;
scrollBar1.Position:=MediaPlayer1.Position;l:=MediaPlayer1.Position;with HMSRec(l) do
begintoolButton11.Caption:=IntToStr(Hours);
toolButton12.Caption:=IntToStr(Minutes);
toolButton13.Caption:=IntToStr(Seconds);
end;
得到的显示效果,非常不理想:hours,Minutes,Seconds老是再变帮帮忙啊!
[email protected]

解决方案 »

  1.   

    MCI控制啦。
    const char* AliasName="AviDev";
    //打开文件
    wsprintf(cmd,"open %s type sequencer alias %s ",LPCTSTR(FileName),AliasName);
    mciSendString(cmd,NULL,0,NULL);
    //设置时间格式
    wsprintf(cmd,"set %s time format ms",AliasName);
    mciSendString(cmd,NULL,0,NULL);
    //得到播放时间,精确到毫秒
    wsprintf(cmd,"status %s length",AliasName);
    mciSendString(cmd,lpstrLength,len,NULL);
    VC中的写法,Delphi中可能有些不同。
      

  2.   

    我比较菜啊!
    不明白!
    最后要delphi的???
    :)
      

  3.   

    mediaplay1er.length表示该音/视频文件的时间长度。
    media1player.position表示当前位置。
    一般人们用的方法是这上面两个量除以1000变成秒(我忘了是否是1000),然后你再继续把它变成分和小时。
      

  4.   

    为什么 设了 tfHMS 格式还是不行????
    不过,让我试试看!!!
    thx
      

  5.   

    急着要啊!!
    [email protected]
    thx!