473,386 Members | 1,741 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,386 software developers and data experts.

Why Console.Beep() doen't beep?

I'm studying C# (I've been a VB developer).

I'm making some tests and I need to use Console.Beep(), but it doesn't make
any sound, no matter if I try it in VS2008 beta or VS2005.

Could anybody tell my some hint abouit it?

--
Rafael
Feb 10 '08 #1
5 28961
I don't know why it doesn't beep,
you might try this function instead:

[DllImport("user32.dll", CharSet=CharSet.Auto, ExactSpelling=true)]
public static extern bool MessageBeep(int type);
HTH,
Sergey Zyuzin
Feb 10 '08 #2
Console.Beep uses the PC Speaker rather than the soundcard (the same speaker
that the BIOS uses).
Do you have a PC Speaker?

Console.Beep(); is the equivelant of calling the Interop Beep method:
\\\
Beep(800, 200);
///
....where the method is defined as:
\\\
[DllImport("kernel32.dll")]
private static extern int Beep(int dwFreq, int dwDuration);
///
The MessageBeep Interop function plays a Wave sound through the soundcard.
There is no need to use MessageBeep via Interop, just use:
\\\
System.Media.SystemSounds.Beep.Play();
///

--
Mick Doherty
http://www.dotnetrix.co.uk/nothing.html
Feb 10 '08 #3
Thank you Mick!!

System.Media.SystemSounds.Beep.Play(); worked just fine. Although I wonder
why Console.Beep(); doesn't beep, there must be some configuration that I
haven't set, or something...

--
Rafael
"Mick Doherty" wrote:
Console.Beep uses the PC Speaker rather than the soundcard (the same speaker
that the BIOS uses).
Do you have a PC Speaker?

Console.Beep(); is the equivelant of calling the Interop Beep method:
\\\
Beep(800, 200);
///
....where the method is defined as:
\\\
[DllImport("kernel32.dll")]
private static extern int Beep(int dwFreq, int dwDuration);
///
The MessageBeep Interop function plays a Wave sound through the soundcard.
There is no need to use MessageBeep via Interop, just use:
\\\
System.Media.SystemSounds.Beep.Play();
///

--
Mick Doherty
http://www.dotnetrix.co.uk/nothing.html
Feb 10 '08 #4
Hi Rafael,

As I stated, Beep uses the PC Speaker, which is attached to the motherboard
(mainboard),
whereas, MessageBeep plays a wave sound through the soundcard. So
Console.Beep() will only sound if you have a PC Speaker attached to the
motherboard.

If you have a PC Speaker then it may have been disabled.
http://www.computerhope.com/issues/ch000725.htm

--
Mick Doherty
http://www.dotnetrix.co.uk/nothing.html
"Rafael" <Ra****@discussions.microsoft.comwrote in message
news:9A**********************************@microsof t.com...
Thank you Mick!!

System.Media.SystemSounds.Beep.Play(); worked just fine. Although I wonder
why Console.Beep(); doesn't beep, there must be some configuration that I
haven't set, or something...

--
Rafael

Feb 11 '08 #5
Thank you Mick!

I checked in the device manager and the non plug and play Beep device was
not disable, although there's another thing with Motherboard cable that I
have to check.

Again, thank!

--

Rafael Soteldo
"Mick Doherty" wrote:
Hi Rafael,

As I stated, Beep uses the PC Speaker, which is attached to the motherboard
(mainboard),
whereas, MessageBeep plays a wave sound through the soundcard. So
Console.Beep() will only sound if you have a PC Speaker attached to the
motherboard.

If you have a PC Speaker then it may have been disabled.
http://www.computerhope.com/issues/ch000725.htm

--
Mick Doherty
http://www.dotnetrix.co.uk/nothing.html
"Rafael" <Ra****@discussions.microsoft.comwrote in message
news:9A**********************************@microsof t.com...
Thank you Mick!!

System.Media.SystemSounds.Beep.Play(); worked just fine. Although I wonder
why Console.Beep(); doesn't beep, there must be some configuration that I
haven't set, or something...

--
Rafael


Feb 13 '08 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Leo | last post by:
hi there i want python to do a beep. in the docu i found in tkinter the method bell() but the script: import Tkinter Tkinter.bell() gives the error:
20
by: Brett Hoerner | last post by:
This is a pretty basic, mostly un-python-related question, although I'm asking because of Python. Is there a different shell I can use (other than cmd.com) to run Python in, where I can...
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
8
by: Marcia Gulesian | last post by:
How can I create a beep in javascript (I.E. 5.5 +) ?
7
by: John Salerno | last post by:
Ok, here's an attempt at something. I figure I can use this to let me know when my laundry's done! :) I'm hoping you guys can spot ways to make it better/cleaner/more efficient, etc. especially...
4
by: Rich | last post by:
Hello, I want to use the Beep() to alert users about certain messages but in my workstation I can't get a sound out of it. But Beep works in VB6. What do I need to do? Sub... .... Beep()...
3
by: Marcel Saucier | last post by:
I have written a Console Application then created a shortcut to it on my desktop. I was able to minimize the DOS window when I click my shortcut so I dont see anymore the DOS window But, using...
0
by: merco | last post by:
hi, i'm trying to write a console application using vbnet2005. It runs ok in a command prompt. Now, i have to use this console application via telnet (using w2003 server as telnet server) but i...
4
by: =?Utf-8?B?UmljaA==?= | last post by:
When I press the Enter key in a Textbox I get a beep sound. But when I press the Enter key in a combobox, I don't get the beep sound. Is there a way to suppress the beep? How to do this? ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.