469,352 Members | 1,982 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,352 developers. It's quick & easy.

Make a Beep

Hi,
I want to throw out a series of 'beep..beep..beep' to the speaker. How to do
that ?
Thanks
Nov 13 '05 #1
3 55680
Console.WriteLine("\a")

will give you one beep.

rajasi

" #Hai" <Re**********@Mail.com> wrote in message
news:#A**************@tk2msftngp13.phx.gbl...
Hi,
I want to throw out a series of 'beep..beep..beep' to the speaker. How to do that ?
Thanks

Nov 13 '05 #2
You can also use P/Invoke to call Kernel32.dll!Beep.

It takes two arguments, the first one the frequency, and the second
one the duration and returns a bool for success.

Frequency must be from 37 to 32,767.

something like:

using System.Runtime.InteropServices;

public class whatever {
[DllImport("Kernel32.dll")]
public static extern bool Beep(UInt32 frequency, UInt32 duration);

public static void beepTime() {
Beep(1000, 300);
System.Threading.Thread.Sleep(300);
Beep(2000, 400);
System.Threading.Thread.Sleep(300);
Beep(500, 200);
System.Threading.Thread.Sleep(300);
}
}

-mike
MVP

" #Hai" <Re**********@Mail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi,
I want to throw out a series of 'beep..beep..beep' to the speaker. How to do that ?
Thanks

Nov 13 '05 #3
Hai,

The best way to do this would be to add a reference to
Microsoft.VisualBasic.dll and to call the static Beep method on the
Microsoft.VisualBasic.Interaction class.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- ni**************@exisconsulting.com

" #Hai" <Re**********@Mail.com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl...
Hi,
I want to throw out a series of 'beep..beep..beep' to the speaker. How to do that ?
Thanks

Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

3 posts views Thread by #Hai | last post: by
19 posts views Thread by Anon Email | last post: by
8 posts views Thread by Marcia Gulesian | last post: by
1 post views Thread by Hai Ly Hoang | last post: by
2 posts views Thread by Hai Ly Hoang | last post: by
5 posts views Thread by John Lee | last post: by
4 posts views Thread by Kartic | last post: by
12 posts views Thread by Peter Stojkovic | last post: by
6 posts views Thread by Michael Maes | last post: by
4 posts views Thread by adi | last post: by
reply views Thread by suresh191 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.