使用MCI command string,已实现mp3、mpg视频、wave音频文件的播放,但编写了如下代码:function OpenMultimedia(wnd:hwnd;AliasName:String;filename:String;typeDevice:String):String;overload;
var
  ShortPathAndFile : String;
  hwnds:string;
Const
  WS_CHILD = '1073741824';
begin
  ShortPathAndfile:=GetShortName(filename);
  str(wnd,hwnds);
  cmd := 'open '+ShortPathAndFile+' type '+typeDevice+
    ' Alias '+AliasName+' parent '+hwnds+' Style '+WS_CHILD +' shareable';
  dwReturn := mciSendString(pchar(cmd), nil, 0, 0);
  If Not( dwReturn = 0) Then
    begin
      Ret:=@MCIReturn;
      mciGetErrorString (dwReturn, ret, 128);
      Result := ret;
      exit
    end;
  Result := 'ok';
end;并做如下调用:
    OpenMultiMedia(form2.handle,'myavi',dlgOpen.FileName,'AVIVideo');
播放AVI时出现
  “The MCI device you are using does not support the specified command.”
上述函数播放mpg视频时正常工作。同样的,对于函数
function OpenMultimedia(AliasName:String;filename:String;typeDevice:String):String;overload;
var
  ShortPathAndFile : String;
begin
  ShortPathAndfile:=GetShortName(filename);
  cmd := 'open '+ShortPathAndFile+' type '+typeDevice+' Alias '+AliasName;
  if TypeDevice='waveaudio' then cmd:=cmd+' buffer 4';
  if TypeDevice='cdaudio' then cmd:=cmd+' shareable';
  dwReturn := mciSendString(pchar(cmd), nil, 0, 0);
  If Not( dwReturn = 0) Then
    begin
      Ret:=@MCIReturn;
      mciGetErrorString (dwReturn, ret, 128);
      Result := ret;
      exit
    end;
  Result := 'ok';
end;
如下调用
OpenMultiMedia(DevAlias,dlgOpen.FileName,'cdaudio');
返回的是:“A problem occured in initializing MCI”。请高手帮助解释和给出正确的命令串。