473,378 Members | 1,401 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

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 55912
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: #Hai | last post by:
Hi, I want to throw out a series of 'beep..beep..beep' to the speaker. How to do that ? Thanks
19
by: Anon Email | last post by:
Hi everyone, Let's see, now. This question is about the capabilities of ANSI C++. I want to write and compile code in ANSI C++ that, when compiled, will make the computer speaker beep; or, at...
8
by: Marcia Gulesian | last post by:
How can I create a beep in javascript (I.E. 5.5 +) ?
1
by: Hai Ly Hoang | last post by:
Hi, I want to make a beep (like MS-DOS beep, not a beep from sound-card). How to do that ? Thanks
2
by: Hai Ly Hoang | last post by:
Hi, I want to make a beep from PC speaker (like C++ beep(), not a beep from sound-card). How to do that ? Thanks
5
by: John Lee | last post by:
Hi, It's anoying each time the computer beeps when MessageBox.Show() popsup - I turned off all sound in control panel - audio setting but it still beeps. Can anyone help? Thanks! John
4
by: Kartic | last post by:
Hi, My program needs to open another form(Form2) at form1 load. But Form2 always opens with a beep. How do I get rid of that beep. I tried to load form2 from Form1 activate also but with no...
12
by: Peter Stojkovic | last post by:
I am now using Beep to make a short warning-sound in my VB-Project What is the aeqivalent command in VS.70, if i dont want use Visual Basic Run-Time Library Members Thanks Peter
6
by: Michael Maes | last post by:
Hello, I'm invoking successive SendKeys.SendWait("{BACKSPACE}") SendKeys.SendWait("{DELETE}") in a loop. The issue is that it causes a Beep on every Pass. Setting the 'Handled = True' on...
4
by: adi | last post by:
Hi My application has many automatic features because it is designed to run without any user interfering. In fact, my app will work on a system without a keyboard or a mouse. Anyway, from time...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.