Hi
I have bit of a problem, I am trying to use sound after the button is cliecked. However it does not work and it doesn't pick up the wav saund as the previous statment is wrong can you please help me out with it and make the sound work.
the error comes up when we come to soundfile$ line PLEASE helpCode:Option Explicit Private Declare Function sndplaysound Lib "winmm.dll" Alias "sndplaysounda" _ (ByVal lpszsoundname As String, ByVal uflags As Long) As Long Const snd_sunc = &H0 Const snd_async = &H1 Const snd_nodefault = &H2 Const snd_loop = &H8 Const snd_nostop = &H10 Dim i As Byte 'numbers in range Dim lTemp As Byte Dim iOuter As Byte Dim iInner As Byte Dim lowest As Byte Dim highest As Byte Dim lUpper As Byte, lLower As Byte Dim lRandom As Byte, lQuantity As Byte, lStart As Byte, lEnd As Byte Dim itemp As Byte Private numbers_Array() As Integer Private Sub cmdGenerate_Click() 'set the variables lQuantity = 6 lStart = 1 lEnd = 49 'Initialize varaibles. ReDim numbers_Array(1 To 49) lowest = LBound(numbers_Array()) 'returns the lowest value declared in the arroy = 1 highest = UBound(numbers_Array()) 'returns the highest value declated in the arroy = 49 'Fill array with numbers in range from 1 to 49. For i = lowest To highest numbers_Array(i) = i + 1 Next i 'do no repeat values, no duplications For i = lowest To highest 'Save the current numbers lTemp = numbers_Array(i) 'Get another random number lRandom = Int(Rnd * (highest - lowest)) + 1 'Swap the numbers numbers_Array(i) = numbers_Array(lRandom) numbers_Array(lRandom) = lTemp Next i 'Sorting for display lowest = LBound(numbers_Array) highest = UBound(numbers_Array) 'Which bubbling pass For iOuter = lowest To highest - 1 'Which comparison For iInner = lStart To lQuantity 'Compare this item to the next item If numbers_Array(iInner) > numbers_Array(iInner + 1) Then 'swaping and sorting values according itemp = numbers_Array(iInner) numbers_Array(iInner) = numbers_Array(iInner + 1) numbers_Array(iInner + 1) = itemp End If Next iInner Next iOuter 'move simulated numbers to labels For i = 0 To (lQuantity - 1) lblNumber(i).Caption = numbers_Array(i + 1) Next i soundfile$ = "K:\year 2\even driven\assignment3\garfield.wav" wflags% = snd_async Or snd_nodefault sound = sndplaysound(soundlike$, wflags%) End Sub
Thanks




Reply With Quote