I have added a wav file to a resource file, its in a folder called WAVE and it has an id of 101.
When I click on the command button, it does not play the sound, instead it plays a beep.
This is what I have:
I am then calling it in the click event of the command button like so:VB Code:
Option Explicit Private Const SND_ASYNC = &H1 Private Const SND_FILENAME = &H20000 Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, _ ByVal hModule As Long, _ ByVal dwFlags As Long) As Long Public Sub ButtonClickSound(cb As CommandButton) With cb PlaySound LoadResData(101, "WAVE"), ByVal 0&, SND_FILENAME Or SND_ASYNC End With End Sub
VB Code:
ButtonClickSound Command1




Reply With Quote