procedure TCBox.MP3(AudioName: string);
var
ShortPathAndfile, durLength, tmpCmd: string;
i: Integer;
begin
ShortPathAndfile:= GetShortName(AudioName);
Cmd := 'open '+ ShortPathAndfile + ' type '+ 'MPEGVideo' + ' Alias ' + 'Hjj';
dwReturn := mciSendString(pchar(Cmd), nil, 0, 0);
if not( dwReturn = 0) then
//文件打开失败
begin
Ret:=@MCIReturn;
mciGetErrorString (dwReturn, ret, 128);//得到错误信息
Exit;
end;
Cmd := 'play ' + 'Hjj';
dwReturn := mciSendString(pchar(Cmd), nil, 0, 0);//播放
tmpCmd := 'status Hjj length';
SetLength(durLength, 128);
dwReturn := mciSendString(PChar(tmpCmd), PChar(durLength), Length(durLength), 0);
mp3Time := StrToInt64(durLength);
end;