Solved

SndPlaySound API Question.

Posted on 1998-07-21
4
264 Views
Last Modified: 2010-05-03
Hello,

I am using the SndPlaySound API call to play wavs for my project. I used to use the MMControl to play sounds, but am using it to play midi music, and found it works best if I use the API to do the wavs.

Problem is, when I used the MMControl, I could assign the wait property false so the playing of the wav did not stop the program execution. However, with the API, when the wav starts to play, all program execution stops until the wav is done playing.

Is there a way to make the SndPlaySound API play the wav sound without stopping program execution until it is finished the wav?

Thanks,

Gary
0
Comment
Question by:garymace
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 7

Accepted Solution

by:
kamall earned 50 total points
ID: 1466358
Use:

Public Const SND_ASYNC = &H1         '  play asynchronously

Regards
0
 
LVL 7

Expert Comment

by:kamall
ID: 1466359
Example:

   SoundName$ = "c:\windows\mywave.wav"
   wFlags% = SND_ASYNC Or SND_NODEFAULT
   x% = sndPlaySound(SoundName$,wFlags%)

The wFlags are as follows:

   Const SND_SYNC = &H0
   Const SND_ASYNC = &H1
   Const SND_NODEFAULT = &H2
   Const SND_LOOP = &H8
   Const SND_NOSTOP = &H10


Regards
0
 

Author Comment

by:garymace
ID: 1466360
Thanks kamall, that was it. Works great now!

Gary

0
 
LVL 7

Expert Comment

by:kamall
ID: 1466361
You are welcome Gary.
Have a nice day.
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

728 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question