C#中播放声音文件

来源:互联网 发布:mac实用app推荐 编辑:程序博客网 时间:2024/05/01 06:57

//播放声音文件 [DllImport("winmm.dll", EntryPoint = "PlaySound")] private static extern bool PlaySound(string pszSound, IntPtr hmod, uint fdwSound); //调用此函数 public void gosound() { string strPath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase; strPath = strPath + "//Music//ring.mp3"; //为声音文件所在路径 PlaySound(strPath, IntPtr.Zero, 0); }