I've written a program in Visual Basic that, among other things, plays a .wav sound file. It works as expected on my desktop computer. When I put the executable on my laptop where Visual Studio is not installed and run it, it works fine except that it doesn't play the sound file. Here is a test program I wrote to investigate the problem:
The laptop plays the Beep put not the .wav file. (I added the Sleep command just to separate the beeps; the problem is the same either way.) It's accessing the .wav file, since if I rename it I get an error message.
The laptop has the latest version of the Microsoft Visual C++ redistributable installed. Is there something else that's missing?
Code:
Sub Idle_Load() Handles Me.Load
Dim appPath, file As String
appPath = Application.StartupPath
file = appPath & "\Beep50.wav"
My.Computer.Audio.PlaySystemSound(System.Media.SystemSounds.Beep)
System.Threading.Thread.Sleep(1000)
My.Computer.Audio.Play(file, AudioPlayMode.WaitToComplete)
End Sub
The laptop has the latest version of the Microsoft Visual C++ redistributable installed. Is there something else that's missing?