Make a Beep

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • #Hai

    #1

    Make a Beep

    Hi,
    I want to throw out a series of 'beep..beep..be ep' to the speaker. How to do
    that ?
    Thanks


  • Rajasi Saha

    #2
    Re: Make a Beep

    Console.WriteLi ne("\a")

    will give you one beep.

    rajasi

    " #Hai" <ReplyToGroup@M ail.com> wrote in message
    news:#AgjpeEQDH A.3768@tk2msftn gp13.phx.gbl...[color=blue]
    > Hi,
    > I want to throw out a series of 'beep..beep..be ep' to the speaker. How to[/color]
    do[color=blue]
    > that ?
    > Thanks
    >
    >[/color]


    Comment

    • Michael Giagnocavo [MVP]

      #3
      Re: Make a Beep

      You can also use P/Invoke to call Kernel32.dll!Be ep.

      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("Kern el32.dll")]
      public static extern bool Beep(UInt32 frequency, UInt32 duration);

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

      -mike
      MVP

      " #Hai" <ReplyToGroup@M ail.com> wrote in message
      news:%23AgjpeEQ DHA.3768@tk2msf tngp13.phx.gbl. ..[color=blue]
      > Hi,
      > I want to throw out a series of 'beep..beep..be ep' to the speaker.[/color]
      How to do[color=blue]
      > that ?
      > Thanks
      >
      >[/color]


      Comment

      • Nicholas Paldino [.NET/C# MVP]

        #4
        Re: Make a Beep

        Hai,

        The best way to do this would be to add a reference to
        Microsoft.Visua lBasic.dll and to call the static Beep method on the
        Microsoft.Visua lBasic.Interact ion class.

        Hope this helps.


        --
        - Nicholas Paldino [.NET/C# MVP]
        - nicholas.paldin o@exisconsultin g.com

        " #Hai" <ReplyToGroup@M ail.com> wrote in message
        news:%23AgjpeEQ DHA.3768@tk2msf tngp13.phx.gbl. ..[color=blue]
        > Hi,
        > I want to throw out a series of 'beep..beep..be ep' to the speaker. How to[/color]
        do[color=blue]
        > that ?
        > Thanks
        >
        >[/color]


        Comment

        Working...