C#让电脑发声,播放声音
//1. [DllImport("Kernel32.dll")] //引入命名空间 using System.Runtime.InteropServices; public static extern bool Beep(int frequency, int duration);// 第一个参数是指频率的高低,越大越高,第二个参数是指响的时间多 Beep(500, 700); //2. [DllImport("winmm.dll")] public static extern bool PlaySound(String Filename, int Mod, int Flags); PlaySound(@"C:\Windows\media\Windows Proximity Notification.wav", 0, 1);