Public Class SoundPlayer Declare Auto Function PlaySound Lib "winmm.dll" (ByVal name _ As String, ByVal hmod As Integer) As Integer ' Public Const SND_SYNC = &H0 ' play synchronously ' Public Const SND_ASYNC = &H1 ' play asynchronously ' Public Const SND_MEMORY = &H4 'Play wav in memory ' Public Const SND_ALIAS = &H10000 'Play system alias wav ' Public Const SND_NODEFAULT = &H2 ' Public Const SND_FILENAME = &H20000 ' name is file name ' Public Const SND_RESOURCE = &H40004 ' name is resource name or atom End ClassAnd I'm trying to call it from a button on a form
Private Sub CmdSound_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CmdSound.Click Dim WaveFile As String Dim SndSync As Integer, SndNoDefault As Integer SndSync = &H0 SndNoDefault = &H2 WaveFile = "C:\Downloads\Sounds\uslsfact.wav" SoundPlayer.PlaySound(WaveFile, SndSync) End SubThe form builds with no errors or warnings, but when I try to run it, I get