110,538
社区成员
发帖
与我相关
我的任务
分享
[DllImport("winmm.dll")]
public static extern bool PlaySound(string pszSound, int hmod, int fdwSound);
public const int SND_FILENAME = 0x00020000;
public const int SND_ASYNC = 0x0001;
//private static string m_strWAV = HttpRuntime.AppDomainAppPath + "file\\warn.wav";
private static string m_strWAV = "http://127.0.0.1/file/warn.wav";
private static string m_strWAV1 = "c:\\warn.wav";
public static System.Timers.Timer m_WarnTimer = null;
//调用
//方法一
PlaySound(m_strWAV1, 0, SND_ASYNC | SND_FILENAME);
//方法二
SoundPlayer sp1 = new System.Media.SoundPlayer(m_strWAV1);
sp1.Play();
//方法三
SoundPlayer player = new SoundPlayer(Properties.Resources.warn); //创建 player 对象
player.PlayLooping();