yellowTIGER
May 21st, 2001, 02:34 PM
How do you can you simply play audio files (ie .wav) when a command is clicked?
Thanks in advance.
yellowTIGER
Thanks in advance.
yellowTIGER
|
Click to See Complete Forum and Search --> : Playing Audio Files yellowTIGER May 21st, 2001, 02:34 PM How do you can you simply play audio files (ie .wav) when a command is clicked? Thanks in advance. yellowTIGER vampyre June 27th, 2001, 03:50 PM put this code in a module (or replace public with private and place anywhere...): public Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (byval lpszSoundName as string, byval uFlags as Long) as Long public Const SND_ASYNC = &H1 public Const SND_LOOP = &H8 public Const SND_MEMORY = &H4 public Const SND_NODEFAULT = &H2 public Const SND_SYNC = &H0 This is all the declaration you need to play a .wav file. Use code of this sort to play a file called "C:\test.wav" when command1 is clicked: private Sub Command1_Click() sndPlaySound "C:\test.wav", SND_ASYNC End Sub This will play the sound and immediately continue to execute code. If you put the flag SND_SYNC instead of SND_ASYNC, code execution will stop until the sound has finished playing (be careful with this one; is you put this kind of sound in a loop, you may hang your system!!!). It's fast and easy. I hope this info was useful! codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |