[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;
//声音文件的名称 strName
public static void GetSound(string strName)
{
PlaySound(Application.StartupPath + string.Format("\\{0}.wav", strName), 0, SND_ASYNC | SND_FILENAME);//声音格式wav,文件存放在程序根目录
}
winform 调用声音文件
最新推荐文章于 2020-05-09 15:26:50 发布