Archive

Archive for the ‘Windows Application’ Category

Play sounds

August 24, 2011 Leave a comment

We can play sounds in  Window application by using Systems.Media namespace

SoundPlayer class is used to load sounds from a location.

To play a sound use Play() method for continuous play use PlayLooping() method.

Here a sample code snippet.

SoundPlayer alrmTone = new SoundPlayer(@"c:\Windows\Media\Windows XP Startup.wav");
alrmTone.PlayLooping();
alrmTone.Stop();