I have a OnClick event on a button that changes the .Visible property on a few images then plays a sound. I notice that the sound always plays *first* no matter what I do THEN the image is updated. It seems as if the image update only occurs until AFTER the sub is finished.
Here is a small code sample...
Private Sub mybutton_Click()
Forms!myform!myimage1.Visible = False
Forms!myform!myimage2.Visible = True
sndPlaySound32 pathtomysoundfiles & "mysound.wav", 0&
End Sub
I have tried wrapping the function call to sndPlaySound32 in another function, I have tried looping delay loops and time delay loops, nothing seems to work. The image should be seen while the sound file is playing not afterwards but I can't seem to make this happen. Any ideas appreciated and thanks!
BTW here is the function for firing off the sound file and as you can see it has been copied in full without even changing the name of the function to make it at least look like it might be an original idea (it wasn't )
Private Declare Function sndPlaySound32 _
Lib "winmm.dll" _
Alias "sndPlaySoundA" ( _
ByVal lpszSoundName As String, _
ByVal uFlags As Long) As Long
To the real author... good job! Your sound function is simple and works great!
Here is a small code sample...
Private Sub mybutton_Click()
Forms!myform!myimage1.Visible = False
Forms!myform!myimage2.Visible = True
sndPlaySound32 pathtomysoundfiles & "mysound.wav", 0&
End Sub
I have tried wrapping the function call to sndPlaySound32 in another function, I have tried looping delay loops and time delay loops, nothing seems to work. The image should be seen while the sound file is playing not afterwards but I can't seem to make this happen. Any ideas appreciated and thanks!
BTW here is the function for firing off the sound file and as you can see it has been copied in full without even changing the name of the function to make it at least look like it might be an original idea (it wasn't )
Private Declare Function sndPlaySound32 _
Lib "winmm.dll" _
Alias "sndPlaySoundA" ( _
ByVal lpszSoundName As String, _
ByVal uFlags As Long) As Long
To the real author... good job! Your sound function is simple and works great!