Solved

SndPlaySound API Question.

Posted on 1998-07-21
4
260 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
  • 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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
vb6 programatically bring window to front 8 72
Restricting text box entry from \/:?<>"| 9 88
change vba from autofit to 13.5 width? 4 29
RUNRMTCMD from AS/400 12 47
I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

831 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