Mega Code Archive

 
Categories / Delphi / Multimedia
 

How can i show cds track, min and sec

Title: How can i show cd's track, min and sec? Question: How can i show cd's track, min and sec? Answer: There is an easy way to do: //create a timer and put this code in the OnTimer event: uses MMSystem; procedure TForm1.Timer1Timer(Sender: TObject); var Trk, Min, Sec: Word; begin with MediaPlayer1 do begin Trk:= MCI_TMSF_TRACK(Position); Min:=MCI_TMSF_MINUTE(Position); Sec:=MCI_TMSF_SECOND(Position); Label1.Caption:=Format('%.2d',[Trk]); Label2.Caption:=Format('%.2d:%.2d',[Min,Sec]); end; end; This code will show current track and time.