使用sndPlaySound或PlaySound播放wav文件, 怎么知道文件已经播放完毕?

解决方案 »

  1.   

    回复人: phy(我希望我是高手,却怎么学都是菜鸟。)具体说明一下, 可以么?
      

  2.   

    为你提供个思路
    用线程来播放
    播放完了,也就是线程的terminate
      

  3.   

    用mciSendString播放可以收到消息:TForm1 = class(TForm)
    ...
    protected
     procedure WndProc(var Message: TMessage); override;
    ...
    end;procedure TForm1.WndProc(var Message: TMessage);
    begin
     if Message.Msg = MM_MCINOTIFY then
       begin
         ShowMessage('notify over!');
       end
     else
       inherited WndProc(Message);
    end;procedure TForm1.Button1Click(Sender: TObject);
    begin
      mciSendString('open "c:\notify.wav" alias notifywav',nil,0,0);
      mciSendString('play notifywav notify',nil,0,Handle);  //第4个参数为回调窗口句柄
    end;
      

  4.   

    to sysu(死树)要是希望播放中途停止, 该怎么办呢?
      

  5.   

    // 中途停止可以用stop
    procedure TForm1.Button2Click(Sender: TObject);
    begin
      mciSendString('stop notifywav notify',nil,0,Handle);
    end;
      

  6.   

    还有很多命令,详细的去查MSDN的mciSendString函数。