How can I make the computer beep in C#?

后端 未结 6 1571
小鲜肉
小鲜肉 2020-12-02 08:02

How do I make the computer\'s internal speaker beep in C# without external speakers?

6条回答
  •  悲哀的现实
    2020-12-02 08:49

    In .Net 2.0, you can use Console.Beep().

    // Default beep
    Console.Beep();
    

    You can also specify the frequency and length of the beep in milliseconds.

    // Beep at 5000 Hz for 1 second
    Console.Beep(5000, 1000);
    

    For more information refer http://msdn.microsoft.com/en-us/library/8hftfeyw%28v=vs.110%29.aspx

提交回复
热议问题