This is easily doable if you use the windows API
First put this into the using section:
using System.Runtime.InteropServices;
Then define the funciton from the API:
[DllImport("winmm.dll")]
private static extern bool PlaySound( string lpszName, int
hModule, int dwFlags );
then provide a wrapper method for the API function:
private void playBtn_Click(object sender, System.EventArgs e)
{
String fileName = this.soundBox.Text;
PlaySound( fileName, 0, 1 );
}
The parameters of the windows API call are as follows:
lpszName - A string that specifies the sound to play.
hModule - Handle to the executable file that contains the
resource to be loaded. We pass in a NULL value instead.
dwFlags - Flags for playing the sound. We pass in SND_ASYNC.
The sound is played asynchronously and PlaySound returns immediately
after beginning the sound.
You can check out all this information here:
http://www.publicjoe.f9.co.uk/csharp/csharp17.html
Hope it helped,
Phil
On Thu, 22 Jul 2004 10:27:26 -0500, "Greg Smith" <gj*@umn.edu> wrote:
Hi, is there a simple way to play a short audio file? Some of my users
would like to hear "There is a new order for your approval" when ever the
situation calls for it. Is this do-able?
Any help is greatly appreciated.