Delphi IDE (89)
Windows with Delphi (280)
Visual Basic (1)
About this site
Links to us
New related comments
Number of comments in the last 48 hours
The meaning of Runtime Error 217
2 new comments
Determine current CD track of TMediaPlayer
This article has not been rated yet. After reading, feel free to leave comments and rate it.
How can I determine the current track of an audio CD played by TMediaPlayer?
The following code will retrieve it from the TMediaPlayer component. If you want to display it on a form, you could put the code in a timer event. You need the unit MMSystem in your uses clause.
You don't like the formatting? Check out SourceCoder then!
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
MMSystem, MPlayer, ExtCtrls, StdCtrls;
TForm1 = class(TForm)
procedure Timer1Timer(Sender: TObject);
procedure TForm1.Timer1Timer(Sender: TObject);
with MediaPlayer1 do
Trk := MCI_TMSF_TRACK(position);
Min := MCI_TMSF_MINUTE(position);
Sec := MCI_TMSF_SECOND(position);
Label1.caption := Format('Track %.2d', [Trk]);
Label2.caption := Format('Position %.2d:%.2d', [Min, Sec]);
coach001 from United States
MarkHelton from India
Nice update to the release page! While on the surface it looks similar, we have made lots of small improvements under the hood and a completely new media player that we'd love to tell you about! The media player now launches at the bottom of the page so you can continue using it. Anyways Thank you so much for this submit and got many ideas from it. All bloggers should have the responsibility to contribute genuine contents.
Haris ohoo from Pakistan