Playing Wav Files

  • Thread starter Thread starter DavidW
  • Start date Start date
D

DavidW

I Have made my own message boxes to display what I need for popups. Custom
Buttons is the Reason
Anyhow they do like that little umph.
How do you play wav file in the on open. I tried the

=PlaySound ("E:\Program Files\Windows NT\somefile")
like what was described, but it lacks something
Any Ideals?
 
From my files ---

-
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
(e-mail address removed)
www.pcdatasheet.com

How To Play A WAV File



Note Put the following code in a form's (General)(Declarations) section or
remove the
Private keywords and put it in a standard Module:

Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" _
(ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
Private Const SND_SYNC = &H0
Private Const SND_ASYNC = &H1
Private Const SND_NODEFAULT = &H2

Note:

1.. SND_ASYNC plays the sound while the program is executing
2.. SND_SYNC make the program wait for the sound to finish
3.. SND_NODEFAULT stops the error sound when the file is not valid.
To Start: To start a WAV file playing, execute this code substituting the WAV
filename and its path in place of the chimes.wav shown in the following example:

sndPlaySound "c:\windows\media\chimes.wav", SND_ASYNC
 
Back
Top