Beep

  • Thread starter Thread starter Guest
  • Start date Start date
[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.
 
Back
Top