» Help

How to determine the track of the current CD

   

Here's an easy way to do it: create a timer and put this code in the OnTimer event:

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;

Add MMSystem to the uses clause of the unit. The code will show the current track and time.

Original resource: The Delphi Pool
Author: Unknown
Added: 2009-11-06
Last updated: 2009-11-06

« Return to contents »