michisoft.com

How to play sounds

This source code allows you to play sounds (*.wav files). If you use vb3 or the 16bit version of vb4, please use the 16bit code, otherwise use the 32bit code.

Select the following code with the mouse and copy it into the general section of a form or module.

---16bit code begins here---

Declare Sub sndplaysound Lib "MMSystem" (ByVal Filename As String, ByVal Flags As Integer)

---code ends here---

---32bit code begins here---

Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal Filename As String, ByVal Flags As Long) As Long

---code ends here---

Use the following code to play a sound:

---code begins here---

Declare Sub sndplaysound Lib "MMSystem" (ByVal Filename As String, ByVal Flags As Integer)

---code ends here---

Go back to my vb-page.