Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sound in C#

Status
Not open for further replies.

darxpan

Programmer
Oct 14, 2003
33
US
I want to make an alarm clock program, but I can't find a way to play sounds except using DirectX, which I want to avoid for this project. How can I play sounds outside without DirectX?
 
You could try this:

Code:
using System.Runtime.InteropServices;


[DllImport("winmm.dll")]
private static extern bool PlaySound( string lpszName, int hModule, int dwFlags );

When you make a call to the method it will look something like:

Code:
PlaySound ("MyFile.wav", null, 1);

Here is a url with that goes into this item a little deeper than I did.


Good Luck.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top