473,396 Members | 1,784 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,396 software developers and data experts.

hi help in playing wav file in vb

i want to play a 2 consecutive wav file on clicking a once commant button.
example. by clickng the command button first.wav will play then the second.wav will follow.

thnx in advance
Oct 15 '07 #1
6 1520
Ali Rizwan
925 512MB
i want to play a 2 consecutive wav file on clicking a once commant button.
example. by clickng the command button first.wav will play then the second.wav will follow.

thnx in advance
Hi
Just do this.

Declarations.

Expand|Select|Wrap|Line Numbers
  1. Private Declare Function sndPlaySound& Lib "winmm.dll" Alias _
  2.     "sndPlaySoundA" (ByVal lpszSoundName As String, ByVal uFlags As Long)
  3.  Const SND_SYNC = &H0
  4.  Const SND_ASYNC = &H1
  5.  Const SND_NODEFAULT = &H2
  6.  Const SND_LOOP = &H8
  7.  Const SND_NOSTOP = &H10
Now add this line.

Expand|Select|Wrap|Line Numbers
  1. sndPlaySound "Sound Path" SND_ASYNC Or SND_NODEFAULT
If you want to play sound for infinite loop then

Expand|Select|Wrap|Line Numbers
  1. sndPlaySound "Sound Path" SND_ASYNC Or SND_NODEFAULT Or SND_LOOP
GOODLUCK
ALI
Oct 15 '07 #2
i know how to play wav files. what i want to know if its possible to play 2 consecutive wav file. because when i worte this code

sndPlaySound "first.wav", SND_ASYNC Or SND_NODEFAULT
sndPlaySound "second.wav", SND_ASYNC Or SND_NODEFAULT

the second.wav only plays.

what i want to know is to play the first.wav first then then second.wav will play too.
is it possible?.

thnx...
Oct 16 '07 #4
Killer42
8,435 Expert 8TB
The way I see it, "ASYNCH" effectively means "continue straight away without waiting". So what happens if you specify SYNCH instead. (You may need to look up the correct name for the value). With luck, it should play the sound before control comes back to run your next line.
Oct 16 '07 #5
thnx everyone. using sync to play consecutive works. thnx a lot. thnx killer42..
Oct 16 '07 #6
Killer42
8,435 Expert 8TB
Glad we could help. :)
Oct 16 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Brian Basquille | last post by:
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...
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: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: 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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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,...
0
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...
0
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,...

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.