首页  编辑  

发送MCI命令字符串

Tags: /超级猛料/Multi-Media.多媒体相关/   Date Created:
发送MCI命令字符串
procedure TForm1.Button1Click(Sender: TObject);
begin
 SendMCICommand('open waveaudio shareable');
 SendMCICommand('play "C:\xyz\BackgroundMusic.wav"');
 SendMCICommand('play "C:\xyz\AnotherMusic.wav"');
 SendMCICommand('close waveaudio');
end;

procedure SendMCICommand(Cmd: string);
var
 RetVal: Integer;
 ErrMsg: array[0..254] of char;
begin
 RetVal := mciSendString(PChar(Cmd), nil, 0, 0);
 if RetVal <> 0 then
 begin
   {get message for returned value}
   mciGetErrorString(RetVal, ErrMsg, 255);
   MessageDlg(StrPas(ErrMsg), mtError, [mbOK], 0);
 end;
end;