The .NET Framework 2.0 finally makes it very easy for your application to play some funky music. First, there's the SystemSounds class, allowing you to play basic, ehm, system sounds like Beep, Exclamation, Question, ... For example: SystemSounds.Asterisk.Play() plays the sound you have selected for the Asterisk event in your active sound scheme.
A bit more interesting is a SoundPlayer class, which lets you choose a custom .wav file to play:
SoundPlayer player = new SoundPlayer(@"c:\Windows\Media\Windows XP Startup.wav");
player.Play();
SoundPlayer lets you load the and play .wav files from a valid URL or a Stream object, in a synchronous or asynchronous manner. And if you really want to annoy your users, then PlayLooping() method is all what you need.
e745f667-2525-4ad1-af13-a2e87617dc6e|3|1.0|27604f05-86ad-47ef-9e05-950bb762570c
Tags :