|
-
Oct 7th, 2002, 03:33 AM
#1
Thread Starter
Hyperactive Member
Stop Sound Now! (Resolved)
Im using the following, which I got here, to play sound:
VB Code:
Private Declare Function sndPlaySound Lib "winmm.dll" Alias "sndPlaySoundA" _
(ByVal lpszSoundName As String, ByVal uFlags As Long) As Long
Private Const SND_ASYNC = &H1
Private Const SND_NODEFAULT = &H2
sndPlaySound "C:\Temp.wav", SND_ASYNC Or SND_NODEFAULT
my question is simple.. how do you stop the sound once it has started. Surprising that no one included this in many of the posts I have looked for here regarding this...
thanks
sac
Last edited by Sacofjoea; Oct 7th, 2002 at 04:51 AM.
-
Oct 7th, 2002, 03:46 AM
#2
Frenzied Member
I think I read somewhere that you just run the same code again, but with no filename:
sndPlaySound "", SND_ASYNC Or SND_NODEFAULT
'Buzby'
Visual Basic Developer
"I'm moving to Theory. Everything works there."
-
Oct 7th, 2002, 03:54 AM
#3
Thread Starter
Hyperactive Member
no luck with that
-
Oct 7th, 2002, 04:00 AM
#4
I've just checked in the API guide, it says you need to set the first parameter to NULL, eg:
sndPlaySound vbNull, SND_ASYNC Or SND_NODEFAULT
-
Oct 7th, 2002, 04:04 AM
#5
Thread Starter
Hyperactive Member
hmm makes sense but isn't working, damn it
-
Oct 7th, 2002, 04:42 AM
#6
Member
Setting the filename to null to stop the sound will only work if the sound is being looped, ie, with the SND_LOOP flag.
VB Code:
'start
sndPlaySound "C:\Temp.wav", SND_ASYNC Or SND_NODEFAULT Or SND_LOOP
'stop
sndPlaySound vbNullString, SND_ASYNC Or SND_NODEFAULT
Sunny
* No trees were harmed in the making or sending of this message. However a great number of electrons were terribly inconvenienced.
-
Oct 7th, 2002, 04:50 AM
#7
Thread Starter
Hyperactive Member
ahh thanks - works
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|