C#调用系统蜂鸣(需要发出警告时挺好用的 即使没有声卡)

http://heavenslv.iteye.com/blog/1033870

 

    1. // 声明  
    2. public class BeepUp  
    3. {  
    4.     /// <param name="iFrequency">声音频率(从37Hz到32767Hz)。在windows95中忽略</param>  
    5.     /// <param name="iDuration">声音的持续时间,以毫秒为单位。</param>  
    6.     [DllImport("Kernel32.dll")] //引入命名空间 using System.Runtime.InteropServices;  
    7.     public static extern bool Beep(int frequency, int duration);  
    8. }  
    9.   
    10. // 调用  
    11. BeepUp.Beep(500, 700); // 这个声音还不错
posted @ 2018-03-14 15:53  LuoCore  阅读(492)  评论(0)    收藏  举报