开发者

A program to repel mosquitoes?

开发者 https://www.devze.com 2022-12-19 03:33 出处:网络
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.

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

精彩评论

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

关注公众号