开发者

A program to repel mosquitoes?

No, I'm serious.

Recently, I read that when the PC's piezo buzzer is made to vibrate at a certain frequency the sound would repel mosquitoes.

Is that true?

How do I progra开发者_StackOverflowmmatically access the PC buzzer (not the speaker), in C# preferably?

I don't know about mosquitoes, but my head hurts like mad. Argh...!


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); 


It seems you can do this with an unmanaged call to native Windows code, as described in http://www.geekpedia.com/code118_Beep-In-The-PC-Speaker.html.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜