| How to play sound |
Applies To |
|
| OS: VB: |
NT, 9x, 2000 5, 6 |
|
| Add the following to a .BAS, .FRM or .CLS |
|---|
'Place in General declarations
Private Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long
Private Const SND_ASYNC = &H1
Private Const SND_FILENAME = &H20000
'Returns True or False indicating whether Sound functions will work
Public Function PlaySoundFile(SoundFile As String) As Boolean
PlaySoundFile = PlaySound(ByVal SoundFile, ByVal 0&, SND_ASYNC Or SND_FILENAME)
End Function