Playing Multimedia Files
You can easily play system sounds or .WAV files through the My.Computer.Audio section of My:
- My.Computer.Audio.PlaySystemSound accepts an enumeration and plays one of the common system sounds such as Beep.
- My.Computer.Audio.Play accepts a path to a .WAV file and an enumeration that indicates how to play—continuously, for example—and plays the .WAV file.
Listing 1 shows two sample statements that play sounds. The first plays the Beep sound, and the second plays the default chime heard when you log off Windows XP.
Listing 1 Two sound statements.
My.Computer.Audio.PlaySystemSound(Media.SystemSounds.Beep) My.Computer.Audio.Play( _ "C:\WINDOWS\Media\Windows XP Logoff Sound.wav", _ AudioPlayMode.WaitToComplete)