Why Console.Beep() doen't beep? - Rafae

09-Feb-08 11:07:00
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
reply
 
 

Why Console.Beep() doen't beep? - Cor Ligthert[MVP]

10-Feb-08 01:27:20
Rafael,

There is not any difference in using classes from Net between Visual Basic
and C#.

The only difference is the program language around that.

So probably there is something else.

Cor
reply
 

Why Console.Beep() doen't beep? - Mick Doherty

10-Feb-08 06:21:19
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
reply
 

Why Console.Beep() doen't beep? - Sergey Zyuzin

10-Feb-08 10:43:29
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
reply
 

Why Console.Beep() doen't beep? - Rafae

10-Feb-08 02:23:02
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
reply
 

Why Console.Beep() doen't beep? - Mick Doherty

11-Feb-08 05:19:04
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
reply
 

Why Console.Beep() doen't beep? - RafaelSoteld

13-Feb-08 08:58:03
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
reply
 
Can I put visual designer's components into a toolbar (the spot where ya drag drop stuff on the form editor))
promotion
Silverlight    WPF    WCF    WWF    LINQ   
JavaScript    AJAX    ASP.NET    XAML   
C#    VB.NET    VB 6.0    GDI+    IIS    XML   
.NET Generics    Anonymous Methods    Delegate   
Visual Studio .NET    Expression Blend    Virus   
Windows Vista    Windows XP    Windows Update   
Windows 2003 Server    Windows 2008 Server   
SQL Server    Microsoft Excel    Microsoft Word   
SharePoint    BizTalk    Virtual Earth   
.NET Compact Framework    Web Service   

"Everything" RSS / ATOM Feed Parser
How to send and receive messages through message queuing in .Net
How to Read text file as database
SQL Server 2005 Paging Performance Tip
Display code of web page.
Fully Scalable Excel File Importer class for .net using Microsoft Jet driver
Generic Chart Color Manager class that can be used for any charts
Helper class to style the infragistics wingrid
Using Reflection to detemine as Assembly Info in and out.
Helper class to play with Window (Owners and position)
Resolving displayname from the culture using the XmlLanguage and LanguageSpecificStringDictionary class