Click to See Complete Forum and Search --> : How to play sounds?


Alex Rest
May 11th, 2005, 05:59 AM
I want to play some windows standard sound as an error alarm.
How do it using C#?

Thanks.

Anders
May 11th, 2005, 06:20 AM
Hm, I don't think there is a way built in .NET, but, for example

[DllImport("winmm.dll")]
public static extern long PlaySound(string lpszName, long hModule, long dwFlags);

can be used. You can do likewise for Beep in the SDK, if all you want is a ... beep.

Also, in .NET 2.0 you have Console.Beep() with one overload.

And then there is ofcourse Windows Media Player to use :-)

HTH!

Alex Rest
May 11th, 2005, 06:56 AM
It is really strange.
I hoped to find something as System. … .PlaySound…
but not
System.Diagnostics.Process.Start("ding.wav"); :sick:

Andy Tacker
May 11th, 2005, 08:28 AM
do a little bit search in this forum, you will find answers