Why Console.Beep() doen't beep?

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?UmFmYWVs?=

    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
  • Sergey Zyuzin

    #2
    Re: Why Console.Beep() doen't beep?

    I don't know why it doesn't beep,
    you might try this function instead:

    [DllImport("user 32.dll", CharSet=CharSet .Auto, ExactSpelling=t rue)]
    public static extern bool MessageBeep(int type);


    HTH,
    Sergey Zyuzin

    Comment

    • Mick Doherty

      #3
      Re: Why Console.Beep() doen't beep?

      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("kern el32.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.Sy stemSounds.Beep .Play();
      ///

      --
      Mick Doherty



      Comment

      • =?Utf-8?B?UmFmYWVs?=

        #4
        Re: Why Console.Beep() doen't beep?

        Thank you Mick!!

        System.Media.Sy stemSounds.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("kern el32.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.Sy stemSounds.Beep .Play();
        ///
        >
        --
        Mick Doherty

        >
        >
        >

        Comment

        • Mick Doherty

          #5
          Re: Why Console.Beep() doen't beep?

          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.


          --
          Mick Doherty



          "Rafael" <Rafael@discuss ions.microsoft. comwrote in message
          news:9A3120BF-0947-4E6E-BA5C-37413002322C@mi crosoft.com...
          Thank you Mick!!
          >
          System.Media.Sy stemSounds.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
          >

          Comment

          • =?Utf-8?B?UmFmYWVsIFNvdGVsZG8=?=

            #6
            Re: Why Console.Beep() doen't beep?

            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.

            >
            --
            Mick Doherty

            >
            >
            "Rafael" <Rafael@discuss ions.microsoft. comwrote in message
            news:9A3120BF-0947-4E6E-BA5C-37413002322C@mi crosoft.com...
            Thank you Mick!!

            System.Media.Sy stemSounds.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
            >
            >
            >

            Comment

            Working...