`
zheyiw
  • 浏览: 997453 次
  • 性别: Icon_minigender_1
  • 来自: 广州
社区版块
存档分类
最新评论

C#音效播放PlaySound

    博客分类:
  • C#
C# 
阅读更多


[DllImport("winmm.dll", EntryPoint = "PlaySound")]
private static extern bool PlaySound(string pszSound, IntPtr hmod, uint fdwSound);
public const int SND_FILENAME = 0x00020000;
public const int SND_ASYNC = 0x0001;

//用API播放声音文件, 异步,覆盖播放(1,不会堵塞UI  2,播放第二个音效的时候,第一个音效自动停止)
void ReadSound(string WavFilePath)
{
	PlaySound(WavFilePath, IntPtr.Zero, SND_FILENAME | SND_ASYNC);      
}

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics