unit ucd;

interface

uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls, MPlayer, ExtCtrls, MMSystem, Buttons;

type
  Tfcd = class(TForm)
    MediaPlayer1: TMediaPlayer;
    Label1: TLabel;
    Label2: TLabel;
    Timer1: TTimer;
    Label3: TLabel;
    Label4: TLabel;
    SpeedButton1: TSpeedButton;
    procedure Timer1Timer(Sender: TObject);
    procedure SpeedButton1Click(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  fcd: Tfcd;

implementation

{$R *.DFM}

procedure Tfcd.Timer1Timer(Sender: TObject);
var 
  Faixa, Min, Seg: Word;
begin
  with MediaPlayer1 do begin
    Faixa := MCI_TMSF_TRACK(Position);
    Min := MCI_TMSF_MINUTE(Position);
    Seg := MCI_TMSF_SECOND(Position);
    Label1.Caption:=Format('%.2d',[Faixa]);
    Label2.Caption:=Format('%.2d:%.2d',[Min,Seg]);
  end;
end;

procedure Tfcd.SpeedButton1Click(Sender: TObject);
begin
  mciSendString('Set cdaudio door closed wait', nil, 0, 0);
end;

procedure Tfcd.FormClose(Sender: TObject; var Action: TCloseAction);
begin
        fcd.Release;
end;

end.
