我知道用ShellExecute()可以实现,但是如果WAV被其它程序关联(如RealOne)时,便会
用该程序播放,怎样可以指定用MediaPlayer播放一段WAV声音?谢谢!

解决方案 »

  1.   

    if MediaPlayer.Mode = mpPlaying then
        MediaPlayer.Stop;
      MediaPlayer.Close;
      Screen.Cursor := crHourGlass;
      Update;
      try
        MediaPlayer.DeviceType := dtAutoSelect;
        MediaPlayer.FileName := 'Your WAVName';
        MediaPlayer.Open;
        MediaPlayer.Play;
      finally
        Screen.Cursor := crDefalut;
      end;  呵呵给分吧!
      

  2.   

    ShellExecute(0, nil, 'mplayer', '"C:\Windows\MEDIA\The Microsoft Sound.wav"', nil, SW_SHOW);
    或者
    ShellExecute(0, nil, 'mplayer2', '"C:\Windows\MEDIA\The Microsoft Sound.wav"', nil, SW_SHOW);
      

  3.   

    用Shell时可以指定可执行文件名的啊。把需要播放的文件作为参数传进去就可以了。