using BPASmartClient.Message; using System; using System.Collections.Generic; using System.Linq; using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; namespace BPASmartClient.MorkS { public class VoiceAPI { public VoiceAPI() { } [DllImport("winmm.dll")] public static extern bool PlaySound(string pszSound, int hmod, int fdwSound); // 系统播放wav格式的文件 public static void m_SystemPlayWav(string strPlayFile) { try { if (strPlayFile.Trim() == "") { return; }//为空不放 string strPath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase; strPath = strPath + strPlayFile; int SND_FILENAME = 0x00020000; int SND_ASYNC = 0x0001; PlaySound(strPath, 0, SND_ASYNC | SND_FILENAME);//播放音乐 } catch (Exception ex) { MessageLog.GetInstance.ShowEx(ex.Message); } } } }