终端一体化运控平台
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

VoiceAPI.cs 1.1 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. 
  2. using BPA.Helper;
  3. using System;
  4. using System.Collections.Generic;
  5. using System.Linq;
  6. using System.Runtime.InteropServices;
  7. using System.Text;
  8. using System.Threading.Tasks;
  9. namespace BPASmartClient.MorkS3
  10. {
  11. public class VoiceAPI
  12. {
  13. public VoiceAPI()
  14. {
  15. }
  16. [DllImport("winmm.dll")]
  17. public static extern bool PlaySound(string pszSound, int hmod, int fdwSound);
  18. // 系统播放wav格式的文件
  19. public static void m_SystemPlayWav(string strPlayFile)
  20. {
  21. try
  22. {
  23. if (strPlayFile.Trim() == "")
  24. { return; }//为空不放
  25. string strPath = AppDomain.CurrentDomain.SetupInformation.ApplicationBase;
  26. strPath = strPath + strPlayFile;
  27. int SND_FILENAME = 0x00020000;
  28. int SND_ASYNC = 0x0001;
  29. PlaySound(strPath, 0, SND_ASYNC | SND_FILENAME);//播放音乐
  30. }
  31. catch (Exception ex)
  32. {
  33. MessageLog.GetInstance.ShowEx(ex.Message);
  34. }
  35. }
  36. }
  37. }