怎么用wait语句让程序在一个地方停产秒中,不要用timer用wait

解决方案 »

  1.   

    procedure TForm1.Button1Click(Sender: TObject);
    begin
      with MediaPlayer1 do 
      begin
        FileName := 'ni!.wav';
        AutoRewind := True;
        Open;          { Open Media Player }
        try
          Wait := True;  { Waits until sounds is done playing to return }
          Play;          { Play sound }
          Play;          { Play again after first playing is completed }
        finally
          Close;             { Close media player }
        end;
      end;
    end;