PC Review


Reply
Thread Tools Rate Thread

Ensuring that a sound stops when process terminates

 
 
Bruno Köller
Guest
Posts: n/a
 
      1st Apr 2004
Robert,

had already loaded a solution, but as I don't support multiposting I'll not
send it.


 
Reply With Quote
 
 
 
 
Robert
Guest
Posts: n/a
 
      1st Apr 2004
Hi everyone,

I noticed that, when using PlaySound to loop a sound infinitely, it won't
stop just because the application exits. Now, normally I would consider it
my responsibility to "clean up" when quitting, but as it may be, the
application could just possibly crash.

Is there any way to ensure that the sound stops playing when the process
terminates, or is there a way to stop the sounds from another process?

Thanks!

Robert


 
Reply With Quote
 
Larry Serflaten
Guest
Posts: n/a
 
      1st Apr 2004

"Bruno Köller" <(E-Mail Removed)> wrote
> Robert,
>
> had already loaded a solution, but as I don't support multiposting I'll not
> send it.


His message looked crossposted to me: vb.winapi & win2000.developer.

Are you aware of the differences?
http://dictionary.reference.com/search?q=crosspost

Crosspost = OK (Not great, but OK)
Multipost = BAD

LFS


 
Reply With Quote
 
Robert
Guest
Posts: n/a
 
      1st Apr 2004
Well, I wasn't aware of this part of netiquette.
I just wasn't sure where it would fit, and rather than writing two different
articles, I'd rather post to two groups (that way the postings are linked at
least, and won't go two seperate ways). That's what I thought.

Now it looks I can't win - If I post again, it would be multiposting. *Sigh*

Is what I'm doing right now off-topic posting or something?

Robert

"Larry Serflaten" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> "Bruno Köller" <(E-Mail Removed)> wrote
> > Robert,
> >
> > had already loaded a solution, but as I don't support multiposting I'll

not
> > send it.

>
> His message looked crossposted to me: vb.winapi & win2000.developer.
>
> Are you aware of the differences?
> http://dictionary.reference.com/search?q=crosspost
>
> Crosspost = OK (Not great, but OK)
> Multipost = BAD
>
> LFS
>
>



 
Reply With Quote
 
Bruno Köller
Guest
Posts: n/a
 
      1st Apr 2004
> His message looked crossposted to me: vb.winapi & win2000.developer.

Cross- or multiposted, asking the same question in more than one newsgroup
looks only like use of usenet as cost free self service. That's a
fundamental misunderstandement.

Why should we answer a guy who doesn't make any effort to find out the
proper newsgroup? It's our time he wastes.

But all those who find cross- or multiposting ok may feel free to answer his
question.

Just my 2c.



 
Reply With Quote
 
Larry Serflaten
Guest
Posts: n/a
 
      1st Apr 2004

"Robert" <(E-Mail Removed)> wrote
> Well, I wasn't aware of this part of netiquette.
> I just wasn't sure where it would fit, and rather than writing two different
> articles, I'd rather post to two groups (that way the postings are linked at
> least, and won't go two seperate ways). That's what I thought.


What you did was more or less correct. Pick 2 or 3 of the most
relavent groups and include them all on the address line. To be
completely proper, you could have added just one group to the
FollowUps line so that continued discussion takes place in only
one of the groups, instead of them all.


> Now it looks I can't win - If I post again, it would be multiposting. *Sigh*


> Is what I'm doing right now off-topic posting or something?



Yep! <g>

As far as an answer goes, provide better error handling so your app
won't crash.

LFS


 
Reply With Quote
 
Larry Serflaten
Guest
Posts: n/a
 
      1st Apr 2004

"Bruno Köller" <(E-Mail Removed)> wrote
> > His message looked crossposted to me: vb.winapi & win2000.developer.

>
> Cross- or multiposted, asking the same question in more than one newsgroup
> looks only like use of usenet as cost free self service. That's a
> fundamental misunderstandement.


Perhaps you have your own ideas, but cost free self-service sounds like
a very good use for message forums.


> Why should we answer a guy who doesn't make any effort to find out the
> proper newsgroup? It's our time he wastes.


How do you know how much effort was used? If he used an API call
in VB on a Win2000 machine, how is it he is off topic? You are being
predjudice wuthout good reason. Should we make a rule that all
questions and replies have to be in perfect english? Or do you
think we should try to help those who are looking for help, even if they
are unfamiliar with the proper usage of the language or posting medium?


> Just my 2c.


And that 2c has cost others looking for the same answer to go looking
elsewhere. If you understand the problem, and know the answer, then
share it. There is no reason to reply, otherwise.

LFS


 
Reply With Quote
 
MikeD
Guest
Posts: n/a
 
      1st Apr 2004

"Robert" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Hi everyone,
>
> I noticed that, when using PlaySound to loop a sound infinitely, it won't
> stop just because the application exits. Now, normally I would consider it
> my responsibility to "clean up" when quitting, but as it may be, the
> application could just possibly crash.
>
> Is there any way to ensure that the sound stops playing when the process
> terminates, or is there a way to stop the sounds from another process?
>


What exactly do you mean by "crash". Are you talking about actual crash as
in a fatal exception or similar and it's when this happens that the sound
doesn't stop? Or do you simply mean an untrapped error in your program? If
the latter, then better error handling is the answer, but even with no error
handling, the sound should stop playing. Consider the following:

Private Sub cmdError_Click()

Dim a As Long
a = 1 / 0

End Sub

Private Sub cmdStart_Click()

PlaySound "h:\winnt\media\ding.wav", 0&, SND_ASYNC Or SND_LOOP

End Sub

Private Sub cmdStop_Click()

PlaySound vbNullString, 0&, SND_ASYNC

End Sub

When run in the IDE, it's actually VB that "owns" the sound. The sound will
continue to play even after dismissal of the error message. You can either
close VB and the sound will stop, or you can rerun the program and click the
Stop button. In the compiled app, the sound will stop after dismissing the
untrapped error's message box (just as it stops in the IDE after you close
VB). I'm mentioning all of this because I kind of get the feeling that what
you noticed was that the sound still plays within the IDE and that you've
never actually "tested" this in the compiled EXE.

If you are talking about an actual crash (i.e. not a trappable runtime
error), then I still suspect that the sound should stop playing. You need
to be clearer on the exact conditions for which you noticed playback doesn't
stop. As I said, I suspect you're talking about an untrapped runtime error
and within the IDE.

Mike


 
Reply With Quote
 
Robert
Guest
Posts: n/a
 
      2nd Apr 2004
Now I'm really worried about my sanity. I was absolutely sure I have tested
this in the executable...now I'm not so sure.

Thanks

Robert

"MikeD" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> "Robert" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
> > Hi everyone,
> >
> > I noticed that, when using PlaySound to loop a sound infinitely, it

won't
> > stop just because the application exits. Now, normally I would consider

it
> > my responsibility to "clean up" when quitting, but as it may be, the
> > application could just possibly crash.
> >
> > Is there any way to ensure that the sound stops playing when the process
> > terminates, or is there a way to stop the sounds from another process?
> >

>
> What exactly do you mean by "crash". Are you talking about actual crash as
> in a fatal exception or similar and it's when this happens that the sound
> doesn't stop? Or do you simply mean an untrapped error in your program?

If
> the latter, then better error handling is the answer, but even with no

error
> handling, the sound should stop playing. Consider the following:
>
> Private Sub cmdError_Click()
>
> Dim a As Long
> a = 1 / 0
>
> End Sub
>
> Private Sub cmdStart_Click()
>
> PlaySound "h:\winnt\media\ding.wav", 0&, SND_ASYNC Or SND_LOOP
>
> End Sub
>
> Private Sub cmdStop_Click()
>
> PlaySound vbNullString, 0&, SND_ASYNC
>
> End Sub
>
> When run in the IDE, it's actually VB that "owns" the sound. The sound

will
> continue to play even after dismissal of the error message. You can

either
> close VB and the sound will stop, or you can rerun the program and click

the
> Stop button. In the compiled app, the sound will stop after dismissing the
> untrapped error's message box (just as it stops in the IDE after you close
> VB). I'm mentioning all of this because I kind of get the feeling that

what
> you noticed was that the sound still plays within the IDE and that you've
> never actually "tested" this in the compiled EXE.
>
> If you are talking about an actual crash (i.e. not a trappable runtime
> error), then I still suspect that the sound should stop playing. You need
> to be clearer on the exact conditions for which you noticed playback

doesn't
> stop. As I said, I suspect you're talking about an untrapped runtime error
> and within the IDE.
>
> Mike
>
>



 
Reply With Quote
 
Robert
Guest
Posts: n/a
 
      2nd Apr 2004
OK, but if someone knows a way to stop sounds played by other processes, I'd
still be very interested.

Robert

"Robert" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Now I'm really worried about my sanity. I was absolutely sure I have

tested
> this in the executable...now I'm not so sure.
>
> Thanks
>
> Robert
>
> "MikeD" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> >
> > "Robert" <(E-Mail Removed)> wrote in message
> > news:%(E-Mail Removed)...
> > > Hi everyone,
> > >
> > > I noticed that, when using PlaySound to loop a sound infinitely, it

> won't
> > > stop just because the application exits. Now, normally I would

consider
> it
> > > my responsibility to "clean up" when quitting, but as it may be, the
> > > application could just possibly crash.
> > >
> > > Is there any way to ensure that the sound stops playing when the

process
> > > terminates, or is there a way to stop the sounds from another process?
> > >

> >
> > What exactly do you mean by "crash". Are you talking about actual crash

as
> > in a fatal exception or similar and it's when this happens that the

sound
> > doesn't stop? Or do you simply mean an untrapped error in your program?

> If
> > the latter, then better error handling is the answer, but even with no

> error
> > handling, the sound should stop playing. Consider the following:
> >
> > Private Sub cmdError_Click()
> >
> > Dim a As Long
> > a = 1 / 0
> >
> > End Sub
> >
> > Private Sub cmdStart_Click()
> >
> > PlaySound "h:\winnt\media\ding.wav", 0&, SND_ASYNC Or SND_LOOP
> >
> > End Sub
> >
> > Private Sub cmdStop_Click()
> >
> > PlaySound vbNullString, 0&, SND_ASYNC
> >
> > End Sub
> >
> > When run in the IDE, it's actually VB that "owns" the sound. The sound

> will
> > continue to play even after dismissal of the error message. You can

> either
> > close VB and the sound will stop, or you can rerun the program and click

> the
> > Stop button. In the compiled app, the sound will stop after dismissing

the
> > untrapped error's message box (just as it stops in the IDE after you

close
> > VB). I'm mentioning all of this because I kind of get the feeling that

> what
> > you noticed was that the sound still plays within the IDE and that

you've
> > never actually "tested" this in the compiled EXE.
> >
> > If you are talking about an actual crash (i.e. not a trappable runtime
> > error), then I still suspect that the sound should stop playing. You

need
> > to be clearer on the exact conditions for which you noticed playback

> doesn't
> > stop. As I said, I suspect you're talking about an untrapped runtime

error
> > and within the IDE.
> >
> > Mike
> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Boot process stops but then continues MartĂ­n M. Windows XP Performance 9 23rd May 2009 07:59 PM
RE: DCOM server process terminates unexpectedly (malware issue) =?Utf-8?B?TWFyayBMLiBGZXJndXNvbg==?= Windows XP Help 1 14th Apr 2007 06:10 PM
MS Anti Spyware process terminates Tim Anti-Spyware Installation 4 5th Sep 2005 11:48 PM
Outlook Application Terminates - Process continues =?Utf-8?B?R2FyeUM=?= Microsoft Outlook Discussion 1 8th Jun 2005 05:48 PM
XP home install won't complete - process stops, reboots, stops again =?Utf-8?B?Q2hhcmxlcyBSIEk=?= Windows XP Setup 1 19th Mar 2004 04:04 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 01:11 PM.