VB Code:
Option Explicit
'I think I've declared everything I should:
Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
Private Const SND_ASYNC = &H1
Private Const SND_SYNC = &H0
Private Const SND_MEMORY = &H4
Private Const SND_FILENAME = &H20000 '<==added
Dim strPath As String '<==added
Dim Bounce As String '<===added
Private Sub Form_Load()
'And in the form load:
If Right(App.Path, 1) = "\" Then
strPath = App.Path
Else
strPath = App.Path & "\"
End If
Bounce = strPath & "Bounce.wav"
End Sub
' In some procedure
If BallX < 0 Then
BallX = 0
BallXDir = 1
'RtnValue = sndPlaySound(Bounce, SND_ASYNC Or SND_MEMORY)
RtnValue = sndPlaySound(Bounce, SND_FILENAME Or SND_ASYNC) '<===added
End If