473,799 Members | 2,927 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 7142
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.c om to reply directly ]

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

Jul 17 '05 #2

"Brian Basquille" <tb********@eir com.netSPAM> wrote in message
news:aj******** ***********@new s.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("boin g.wav", 0, 0)

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

Declare Function waveOutGetNumDe vs Lib "winmm.dll" Alias "waveOutGetNumD evs"
() 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 "sndPlaySou ndA" (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********@eir com.netSPAM> wrote in message
news:aj******** ***********@new s.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********@eir com.netSPAM> wrote in message
news:aj******** ***********@new s.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
9344
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 not work for me. Maybe it would be best to try to play a small mp3 or wav file instead - does VB 6.0 have built-in support for sounds like that? Tom
1
2870
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 seperate file in a specific directory, but instead 'integrate' it in my application? Thanks peter
2
4479
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 playing and i get black image!!! Why? What i should considre when i open a new thread in c# application?? Thanks
7
6462
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? Thanks in advance. -Lee
8
2538
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 then playing it as Avi file. An alternative way is encapsulate the binary data into the exe file with a recourse file and than playing it.
0
2481
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 want to set its style to "display: none;" and interact only with the standard file upload dialog (which can be summoned by firing the click() method of the control). Attempting programmatic access of a file upload control is generally playing...
1
3313
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 the user it is buffering until the video actually begins to play in the browser. Thanks for any help! JJ
4
4613
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
11137
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
9541
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10482
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10251
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10225
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10027
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9072
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5463
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4139
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3759
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.