一个驱逐蚊子的计划?

不,我认真的。

最近,我读到当PC的压电蜂鸣器以一定的频率振动时,声音会击退蚊子。

真的吗?

如何在C#中以编程方式访问PC蜂鸣器(而不是扬声器)?

我不知道蚊子,但我的头疼得像疯了似的。 啊…!

using System.Runtime.InteropServices; [DllImport("KERNEL32.DLL", EntryPoint="Beep",SetLastError=true,CharSet=CharSet.Unicode, ExactSpelling=true,CallingConvention=CallingConvention.StdCall)] public static extern bool Beep(int pitch , int duration); Beep(500,1000); 

您可以使用对本机Windows代码的非托管调用来执行此操作,如http://www.geekpedia.com/code118_Beep-In-The-PC-Speaker.html中所述 。