Connecting Tech Pros Worldwide Help | Site Map

Make a Beep

 
LinkBack Thread Tools Search this Thread
  #1  
Old November 13th, 2005, 07:58 PM
#Hai
Guest
 
Posts: n/a
Default Make a Beep

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



  #2  
Old November 13th, 2005, 07:58 PM
Rajasi Saha
Guest
 
Posts: n/a
Default Re: Make a Beep

Console.WriteLine("\a")

will give you one beep.

rajasi

" #Hai" <ReplyToGroup@Mail.com> wrote in message
news:#AgjpeEQDHA.3768@tk2msftngp13.phx.gbl...[color=blue]
> Hi,
> I want to throw out a series of 'beep..beep..beep' to the speaker. How to[/color]
do[color=blue]
> that ?
> Thanks
>
>[/color]


  #3  
Old November 13th, 2005, 07:58 PM
Michael Giagnocavo [MVP]
Guest
 
Posts: n/a
Default Re: Make a Beep

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" <ReplyToGroup@Mail.com> wrote in message
news:%23AgjpeEQDHA.3768@tk2msftngp13.phx.gbl...[color=blue]
> Hi,
> I want to throw out a series of 'beep..beep..beep' to the speaker.[/color]
How to do[color=blue]
> that ?
> Thanks
>
>[/color]


  #4  
Old November 13th, 2005, 07:58 PM
Nicholas Paldino [.NET/C# MVP]
Guest
 
Posts: n/a
Default Re: Make a Beep

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]
- nicholas.paldino@exisconsulting.com

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


 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Popular Articles

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over 220,662 network members.