日期:2014-05-17 浏览次数:21013 次
System.Media.SoundPlayer player = new SoundPlayer();
player.SoundLocation = "c:\\test.wav"; //这里是文件路径
player.LoadAsync();
player.PlayLooping(); //asynchronous (loop)playing in new thread
Thread.Sleep(5000);
player.Stop();
//实例化和启动,test为方法名
Thread thread1 =new Thread(test);
thread1.Start();
//这是停止线程
try
{
if (thread1.IsAlive)
{
thread1.Abort();
}}