473,387 Members | 1,440 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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 7089
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Kiteman \(Canada\) | last post by:
Instead of a beep sound playing as an alarm or reminder I would like to be able to play a more interesting sound. On the web, I found and tried a sound routine that uses the SOUND.DRV but it does...
1
by: Peter Schmitz | last post by:
Hi, I'm just trying to play a *.wav file, making use of the unmanaged function "sndPlaySoundA" in winmm.dll, but I still got one question: How can I avoid, that the sound file itself has to be...
2
by: Dave | last post by:
Hi, I am writing a c# application that using a directshow to play file and display it on my C# gui, its work just fine but when i try to open another thread in my c# application the file stop...
7
by: Lee Moody | last post by:
I just want quick and easy way to play a .wav file out the standard sound device. It could even be as simple as activating a sound assigned to an existing windows sound event. Any suggestions?...
8
by: shlomi | last post by:
Hello, It's been long time that I'm investigating on how to play Avi file from memory, with no success. What I'm trying to do is to get a scrambled Avi file to memory, fix same data and...
0
by: Raven Jones | last post by:
Heya all, I'm working on a web-based application (using ASP.NET and C# on .NET 1.1.4322, supporting only IE6 for Windows) that allows for file uploads. Screen real estate is at a premium, so I...
1
by: majestik | last post by:
Question, can I see an event in Javascript that tells me a video starts playing using the <embed src="file.wmv>. I stream the video, but there is a wait time and wanted to pop up a message telling...
4
by: fAnSKyer/C# newbie | last post by:
I am using winmm.dll and I found that I can't just suspend it and resume it? What should I do? Any better idea? Should I use thread? and thread.suspend will work? Thanks
5
by: gazza67 | last post by:
Hi, Does anyone know how to check for when a sound has finished playing? I am currently using the SoundPlayer, there doesnt seem to be any event for this - am I missing something? Gary
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.