Playing a wav file?

spowers21

Registered User.
Local time
Today, 05:10
Joined
Mar 28, 2002
Messages
49
I have searched for this answer but have not found a simple solution to this and there may not be one. Is the a way to play a wav file or any other sound file in an after update event to serve as a confirmation tone to a particular action ( ie: bar code scan confirmation tone) ?
 
spowers21 said:
I have searched for this answer but have not found a simple solution to this and there may not be one. Is the a way to play a wav file or any other sound file in an after update event to serve as a confirmation tone to a particular action ( ie: bar code scan confirmation tone) ?

Actually, it is pretty simple. All you have to do is declare the "PlaySound" API function in a public module, and then call it with the function call.

If you need the declaration and call, you can look here:

http://mech.math.msu.su/~vfnik/WinApi/p/playsound.html

If all you need is a simple beep, why don't you just use the "Beep" command?

Shadow
 
spowers21 said:
I have searched for this answer but have not found a simple solution to this and there may not be one. Is the a way to play a wav file or any other sound file in an after update event to serve as a confirmation tone to a particular action ( ie: bar code scan confirmation tone) ?

Don't know about playing a wav file but, if all you want is a conformation, you could use the 'beep' command
 
shadow9449 said:
Actually, it is pretty simple. All you have to do is declare the "PlaySound" API function in a public module, and then call it with the function call.

If you need the declaration and call, you can look here:

http://mech.math.msu.su/~vfnik/WinApi/p/playsound.html

If all you need is a simple beep, why don't you just use the "Beep" command?

Shadow

I have used it but it not exactly what I am looking for. The environment my system is working in is pretty noisy and that tone seems a little muffled. Thanks for your post!
 
spowers21 said:
I have searched for this answer but have not found a simple solution to this and there may not be one.
How hard did you search? I have this code posted in quite a few threads and you can call the
"PlayWaveFile" function anywhere you want.

Code:
Option Compare Database
Option Explicit
  
'PlayWaveFile
Declare Function apisndPlaySound Lib "winmm" Alias "sndPlaySoundA" (ByVal filename As String, ByVal snd_async As Long) As Long
    
Public Function PlayWaveFile(sWavFile As String)
    
    If apisndPlaySound(sWavFile, 1) = 0 Then
        'MsgBox "The Sound Did Not Play!"
    End If
    
End Function
    
Public Sub PlayWaveFile_Cord()
    
    [COLOR=Blue]Call PlayWaveFile("C:\Windows\Media\chord.wav")[/COLOR]
    
End Sub
 

Users who are viewing this thread

Back
Top Bottom