Re: Clear Stack
- From: "Tony Proctor" <tony_proctor@xxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Tue, 18 Oct 2005 12:30:01 +0100
To unwind the stack, just raise an exception that's handled by a procedure
near the root of your stack. Reserve a dedicated error code for this
purpose, e.g.
Public Const ERR_UNWIND As Long = vbObjectError OR 1000
When necessary, raise this using something like:
Err.Raise ERR_UNWIND, TypeName(Me), "Unwinding stack"
In all your local error handlers, test for this explicit error code. If
that's the one then re-throw the error, else handle it as per normal, e.g.
LocalErrHandler:
If Err.Number = ERR_UNWIND Then
' Re-raise the error for someone else to handle
Err.Raise Err.Number, Err.Source, Err.Description, Err.HelpFile,
Err.HelpContext
Else
...handle the error as per normal...
End If
That reserved error code will eventually find its way to your root
procedure, at which point your stack will have been reset as requested
Tony Proctor
<theycallmebill@xxxxxxxxx> wrote in message
news:1129623691.318589.155340@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
> Hi all,
>
> Is there a way to clear the event queue and the stack?
>
> I have a communication program where I am several sub routines deep and
> in the event of an error on the other end, I need to keep the program
> from returning to all the subs. I could write a ton of code to do this,
> but I really would like to simply clear the queue.
>
> Bill
>
.
- References:
- Clear Stack
- From: theycallmebill
- Clear Stack
- Prev by Date: Re: Add a document to my project?
- Next by Date: Re: Naming Convention
- Previous by thread: Re: Clear Stack
- Next by thread: welcome to Mthemes the NO.1 Mobile Themes Park for 3G
- Index(es):
Relevant Pages
|
|