469,353 Members | 2,282 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,353 developers. It's quick & easy.

Playing a WAV File?

Hello all,

What is the syntax for simply playing a WAV file in your program?

Am learning VB and have two VB books but don't wanna root through them to
find the code.

Any help would be much appreciated!

Thanks in advance,
Brian
Jul 17 '05 #1
4 6903
Give me permission and a valid e-mail address that
can accept up to 1 mb files and I'll forward a zip
file with numerous examples of how to play wav
files.

E-mail me at the address listed below.

--
Thanks !

Jim

[ lo*****@yahoo.com to reply directly ]

"If you are living like there is no God ...
... you better be right !"

Jul 17 '05 #2

"Brian Basquille" <tb********@eircom.netSPAM> wrote in message
news:aj*******************@news.indigo.ie...
Hello all,

What is the syntax for simply playing a WAV file in your program?

Am learning VB and have two VB books but don't wanna root through them to
find the code.

Any help would be much appreciated!

Thanks in advance,
Brian


A couple of ways... here is one:

Declare Function PlaySound Lib "winmm.dll" Alias "PlaySoundA" (ByVal
lpszName As String, ByVal hModule As Long, ByVal dwFlags As Long) As Long

dim wav&
wav& = PlaySound("boing.wav", 0, 0)

Jul 17 '05 #3
Try this:
---------------------------------
Detect if Sound Card Available:

Declare Function waveOutGetNumDevs Lib "winmm.dll" Alias "waveOutGetNumDevs"
() as Long

- Returns number of devices available to Play sound files (returns 0 if none
available)

---------------------------------
Play Sound:

Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" (ByVal
lpszSoundName As String, ByVal uFlags As Long) as Long

lpzSoundName - Name of sound to play
uFlags - Options for playing the sound

Constants:
SND_SYNC - played synchronously, function does not return until
sound ends
SND_ASYNC - played asynchronously, function returns immediately
after beginning sound
SND_NODEFAULT - if sound cannot be found, returns silently without playing
the default sound
SND_LOOP - will continually play sound until sndPlaySound is
called with a null
SND_NOSTOP - if sound currently playing, returns false without
playing the requested sound
Good Luck!!!

Gonzo

"Brian Basquille" <tb********@eircom.netSPAM> wrote in message
news:aj*******************@news.indigo.ie...
Hello all,

What is the syntax for simply playing a WAV file in your program?

Am learning VB and have two VB books but don't wanna root through them to
find the code.

Any help would be much appreciated!

Thanks in advance,
Brian

Jul 17 '05 #4
Try this:
Use Google
"Brian Basquille" <tb********@eircom.netSPAM> wrote in message
news:aj*******************@news.indigo.ie...
Hello all,

What is the syntax for simply playing a WAV file in your program?

Am learning VB and have two VB books but don't wanna root through them to
find the code.

Any help would be much appreciated!

Thanks in advance,
Brian

Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Kiteman \(Canada\) | last post: by
1 post views Thread by Peter Schmitz | last post: by
2 posts views Thread by Dave | last post: by
7 posts views Thread by Lee Moody | last post: by
8 posts views Thread by shlomi | last post: by
4 posts views Thread by fAnSKyer/C# newbie | last post: by
5 posts views Thread by gazza67 | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.