刚写给别人的,你可以使用。
uses MMSystem;
var t1:array[0..128] of Char;
maxLen,curlen:Integer;
{$R *.dfm}
procedure TForm1.Button1Click(Sender:TObject);
begin
MCISendString('OPEN c:/1.mp3 ALIAS NN',0,0,0);
//打开
MCISendString('status NN length',@t1[0],127,0);
//返回音乐长度
maxLen:=StrToInt(t1);
Label2.Caption:=IntToStr(maxLen);
MCISendString('PLAY NN from 0 ',000,10000,0);
//开始播放
Timer1.Enabled:=true;
end;
procedure TForm1.Timer1Timer(Sender:TObject);
begin
MCISendString('status NN position',@t1[0],127,0);
//获取当前长度
curlen:=StrToInt(t1);
if ( curlen>=maxLen) then
MCISendString('PLAY NN from 0',0,0,0);
//如果播放完成,重新开始
Label1.Caption:=t1;
end;