用mediaplay控件,取得一个视频文件的length后,如何转换为普通时间啊,帮助的例子是
type HMSRec = record
Hours: byte;
Minutes: byte;
Seconds: byte;
NotUsed: byte; end;procedure TForm1.Button1Click(Sender: TObject);var
TheLength: LongInt;
begin { Set time format - note that some devices don抰 support tfHMS } MediaPlayer1.TimeFormat := tfHMS;
{ Store length of currently loaded media }
TheLength := MediaPlayer1.Length;
with HMSRec(TheLength) do { Typecast TheLength as a HMSRec record }
begin
Label1.Caption := IntToStr(Hours); { Display Hours in Label1 }
Label2.Caption := IntToStr(Minutes); { Display Minutes in Label2 }
Label3.Caption := IntToStr(Seconds); { Display Seconds in Label3 }
end;
end;我试过可是不对,请问各位高人问题出在哪里呢?
type HMSRec = record
Hours: byte;
Minutes: byte;
Seconds: byte;
NotUsed: byte; end;procedure TForm1.Button1Click(Sender: TObject);var
TheLength: LongInt;
begin { Set time format - note that some devices don抰 support tfHMS } MediaPlayer1.TimeFormat := tfHMS;
{ Store length of currently loaded media }
TheLength := MediaPlayer1.Length;
with HMSRec(TheLength) do { Typecast TheLength as a HMSRec record }
begin
Label1.Caption := IntToStr(Hours); { Display Hours in Label1 }
Label2.Caption := IntToStr(Minutes); { Display Minutes in Label2 }
Label3.Caption := IntToStr(Seconds); { Display Seconds in Label3 }
end;
end;我试过可是不对,请问各位高人问题出在哪里呢?
TimeFormat := tfHMS;
L := IntToStr(Length);
Label1.Caption := copy(l,1,4);
Label2.Caption := copy(l,5,4);
label3.Caption := copy(l,9,4);
end;