vb.net Is there a simple way to add a sound to a button click

Posted by user867621 on Stack Overflow See other posts from Stack Overflow or by user867621
Published on 2012-03-21T23:26:41Z Indexed on 2012/03/21 23:30 UTC
Read the original article Hit count: 249

Filed under:

Is there a simple way of doing this

I found this online and I am getting an error

 Declare Function apisndPlaySound Lib "winmm" Alias "sndPlaySoundA" _
(ByVal filename As String, ByVal snd_async As Long) As Long


Function PlaySound(ByVal sWavFile As String)
    ' Purpose: Plays a sound.
    ' Argument: the full path and file name.

    If apisndPlaySound(sWavFile, 1) = 0 Then
        MsgBox("The Sound Did Not Play!")
    End If
End Function

A call to PInvoke function 'WindowsApplication3!WindowsApplication3.Module1::apisndPlaySound' has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.

© Stack Overflow or respective owner

Related posts about vb.net