PDA

Click to See Complete Forum and Search --> : another two questions (sounds and buttons)


spandex44
Jan 23rd, 2000, 01:09 AM
Hello,
I've got two questions. First of all, in my program, when you press a command button, a loop is started. Whenever you press it again, it restarts the loop. The program involves movement with the arrow buttons, rather than the mouse, so the next time the user presses the Space bar, the command button is activated, because it remained activated from the previous click. Wooh, that was a run on sentence!

Second question:
This is the code I'm using to play WAV files:

Declarations:
Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" _
(ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
Const SND_SYNC = &H0
Const SND_ASYNC = &H1
Const SND_NODEFAULT = &H2
Const SND_LOOP = &H8
Const SND_NOSTOP = &H10
Code:

SoundFile$ = "d:\tank\boomhit.wav"
wFlags% = SND_ASYNC Or SND_NODEFAULT
x% = sndPlaySound(SoundFile$, wFlags%)


Whenever I try to play two sounds at once, one sound stops, while the other one plays. How can I make both play at the same time? Thanks.

------------------
Regards,
Alexander McAndrew
VB Zone
http://gsenterprise.server101.com

Bob Baddeley
Jan 23rd, 2000, 05:04 AM
For the first problem, try changing the tab index of the command button. That would set the focus on something else.

For the second, I haven't tried it, but I think all you need to do is change the Flags part to SND_SYNC instead of SND_ASYNC. I believe that is your problem. If not, try changing some of the other flags around, messing around with various combinations until you get it.

good luck

bob