He you guys, I'm gettin' better everyday in VB. How do I play wav files in VB without using the mediaplayer or any other program for it?
Printable View
He you guys, I'm gettin' better everyday in VB. How do I play wav files in VB without using the mediaplayer or any other program for it?
Code:'Play A sound
'
'API Function to play the sound
'bas module code
Declare Function PlaySound Lib "winmm.dll" _
Alias "PlaySoundA" (ByVal lpszName As String, _
ByVal hModule As Long, ByVal dwFlags As Long) As Long
'form code
Private Sub Command1_Click()
'Play wav
PlaySound "C:\A Wayne\YourFile.wav", 0&, &H1
End Sub
Private Sub Command2_Click()
'Stop wav
PlaySound "C:\A Wayne\YourFile.wav", 0&, &H4
End Sub