Помощь - Поиск - Пользователи - Календарь
Полная версия: Length
Форум «Всё о Паскале» > Современный Паскаль и другие языки > Делфи
Артемий
Здравствуйте!У меня к вам такой вопрос-как,зная MediaPlayer.Length узнать полное время трэка в формате час/мин/сек?Заранее спасибо!
klem4
Цитата(Delphi HELP)
The following code declares a HMSRec record with four byte fields. If TimeFormat is tfHMS, the first field specifies hours, the second field specifies minutes, the third field specifies seconds, and the fourth field corresponds to the unused most-significant byte of the tfHMS time format. A LongInt variable is typecast to an HMSRec record, then the hours, minutes, and seconds of the Length of the loaded media are displayed in labels when the user clicks a button.

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’t 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;
Артемий
Не могу не сказать спасибо!
Это текстовая версия — только основной контент. Для просмотра полной версии этой страницы, пожалуйста, нажмите сюда.