How do I play a wav file when a form is loaded?? I have tried many examples I have found on the web with no sucess. I would like it to play when the form is loaded and only play once.
Thanks,
Kevin
Printable View
How do I play a wav file when a form is loaded?? I have tried many examples I have found on the web with no sucess. I would like it to play when the form is loaded and only play once.
Thanks,
Kevin
Use the sndPlaySound API. Put the following code in a module.
Now add this code to the Form's Initialize eventCode:Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
Code:Private Sub Form_Initialize()
Call sndPlaySound("C:\MyaveFile.wav", &H1)
End Sub
Thanks. That worked great!
Kevin