要时间来控制? var T:TSYSTEMTIME; begin Form1.MediaPlayer1.Play; Timer5.Enabled:=True; Timer1.Enabled:=True; Timer1Timer(nil); T.wMinute:=Mediaplayer1.Length div 60000; T.wSecond:=Mediaplayer1.Length mod 60000; Label4.Caption:=IntToStr(T.WMinute)+':'+ IntToStr(T.wSecond);
ShowMessage(IntToStr(MediaPlayer1.Length)) 得到1144MediaPlayer1.TimeFormat := tfMilliseconds;
ShowMessage(IntToStr(MediaPlayer1.Length));得到4576245762毫秒时间是对的,但1144如何分段解释哪?
begin
Self.MediaPlayer1.FileName := Self.OpenDialog1.FileName;
Self.MediaPlayer1.Open;
Self.MediaPlayer1.TimeFormat := tfMilliseconds;
ShowMessage(IntToStr(Self.MediaPlayer1.Length DIV 1000));
end;TimeFormat 用于指定时间的格式,由四个字节的整数组成,取值及含义:
tfMilliseconds : 四个字节为一个变量以毫秒为单位
tfHMS : 时、分、秒、未用
tfMSF : 分、秒、Frames、未用
tfFrames : 四个字节为一个变量以帧为单位
tfSMPTE24 : 以 24-Frame 计数:时、分、秒、Frames
tfSMPTE25 : 以 25-Frame 计数:时、分、秒、Frames
tfSMPTE30 : 以 30-Frame 计数:时、分、秒、Frames
tfSMPTE30Drop : 以 30-Drop-Frame 计数:时、分、秒、Frames
tfBytes : 时间按字节存储四字节整数
tfSamples : 时间按Samples存储四字节整数
tfTMSF : 轨道、分、秒、Frames
var
T:TSYSTEMTIME;
begin
Form1.MediaPlayer1.Play;
Timer5.Enabled:=True;
Timer1.Enabled:=True;
Timer1Timer(nil);
T.wMinute:=Mediaplayer1.Length div 60000;
T.wSecond:=Mediaplayer1.Length mod 60000;
Label4.Caption:=IntToStr(T.WMinute)+':'+
IntToStr(T.wSecond);