110,534
社区成员
发帖
与我相关
我的任务
分享
System.Media.SoundPlayer player = new System.Media.SoundPlayer();
string strPath = System.Environment.CurrentDirectory; //获取程序目录
strPath = strPath + "\\WAV" + "\\aaa.wav";
player.SoundLocation = strPath;
player.Load();
player.Play();
我不知道如果音频文件损坏或无效load 或 play的时候会不会报错,你自己试下,如果报错捕捉一下异常就行了。。。