unit ConvertToWav;interfaceuses
SysUtils, Variants, Classes,Types,FileOperator,DataTypeDef,StrUtils,MMSystem,DMUnit,ADODB,ActiveX,ComObj,
Windows,Forms;type
TSoundInfo = class
class function GetSoundLength(fileName: string): Integer;
end;implementation
class function TSoundInfo.GetSoundLength(fileName: string): Integer;
var
lengthBuf:Array[0..31] of Char;
begin
MCISendString(PChar('open "'+fileName+'" type waveaudio alias wave'),nil,0,0);
MCISendString('status wave length',lengthBuf,Length(lengthBuf),0);
MCISendString('close wave',nil,0,0); try
Result:=StrToInt(lengthBuf) div 1000;
except
Application.MessageBox('获取通话时长出错','',0);
end;
end;如上代码调用在 WindowsXP 和 Windows7下都正常,在Windows Server2003下出错,请问是什么原因? 谢谢大家!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货