tags:

views:

476

answers:

2

No, I'm serious,

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

Is that true ?

How do I programmatically access the PC buzzer (not the speaker) in C# preferably

this is a Honest question folks :)

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

+2  A: 

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

xan
+11  A: 
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); 
TP
It's worth mentioning that the Beep driver has undergone some changes in Win7 that may affect using it for this purpose: http://blogs.msdn.com/larryosterman/archive/2010/01/04/what-s-up-with-the-beep-driver-in-windows-7.aspx :)
Rob
You wouldn't need a comment explaining the function's parameters if you had given them descriptive names.
P Daddy
My dog just started howling, I only read the code. Must be working.
Hans Passant