How to beep using PC speaker?

后端 未结 3 1883
挽巷
挽巷 2021-01-02 13:06

I want to make a beep sound using PC speaker in C#. When using the following code:

[DllImport(\"kernel32.dll\", EntryPoint = \"Beep\", SetLastError = true,
E         


        
3条回答
  •  一向
    一向 (楼主)
    2021-01-02 13:38

    Do you have any 32 bit Windows machines lying around? Try Console.Beep(); on one of those, the PC speaker will beep.

    On 64 bit Windows (XP, Vista, 7 or 8) the driver to do this isn't present so it will come out of the speaker plugged into the machine instead.

    Also, correct me if I'm wrong but I would hazard a guess that the beep you hear whenever your PC turns on is from your BIOS, before you actually hit Windows 8.

提交回复
热议问题