Beep

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am new to .net and C#. Is there a way to initiate a default beep sound
effect?

Thanks
 
[DllImport("kernel32.dll")]
public static extern bool Beep(int freq,int duration);




Best Regards,



Ido Samuelson

Senior Consultant

Advantech – Microsoft Division (Magen)

(e-mail address removed)




http://www.magen.com
I am new to .net and C#. Is there a way to initiate a default beep sound
effect?

Thanks
 
I am new to .net and C#. Is there a way to initiate a default beep sound
effect?

Thanks

Use '\a' ('a' for Alert):

namespace Beep {
class Program {
static void Main(string[] args) {
Console.WriteLine("\a");
}
}
}

rossum


The ultimate truth is that there is no ultimate truth
 
Ho hum.... so boring... Try this instead:

1. Install DirectX 9.0 SDK
2. Create a Windows Forms application
3. Add a reference to Microsoft.DirectX.DirectSound
4. Add the following code:

using Microsoft.DirectX.DirectSound;
....
private void button1_Click(object sender, System.EventArgs e)
{
Device dev = new Device();
dev.SetCooperativeLevel(this,CooperativeLevel.Normal);
BufferDescription buffer_desc = new BufferDescription();
SecondaryBuffer buffer = new SecondaryBuffer(
@"C:\WINDOWS\Media\ding.wav",
buffer_desc,
dev);
buffer.Play(0,BufferPlayFlags.Default);
}

Or use any wav file you like -- Live a little!!!!

- Harlow.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Unknown source of beeping 14
continuous BIOS beep 2
How to tell when Beep sound is done? 2
No image on dell studio 540 3
Beep() 2
No boot-up beep....sometimes 4
Can not insert text using mspaint 4
Beep Not Working 7

Back
Top