In the System::Speech namespace there asychronous methods on both the SR and
TTS sides. For example, RecognizeAsync( ) and SpeakAsync( ). For the
purposes of this discussion, it isn't important what these methods do, but
how they do them. That is, upon executing these methods, they do not
necessarily complete what they are intended to do before the code execution
moves past them to the following instructions. When they are done they
typically will cause an Event to happen that notifies the program the
operation is done.
I have a case where the operation of such an asynchronous function is
causing a system exception error. Is it possibly to try-catch such an
exception? Will putting the asynchronous method do it, something like:
try
{
MethodAsynch();
}
catch(...)
{
//...
}
Will wrapping the entire application's execution do it:
try
{
main()
{
//all code, contains any asynch method calls
}
catch(...)
{
//...
}
Will both/neither of these methods work? Assuming it is possible, what is
the way typically used?
Thanx!
[==Peter==]
Doug Harrison [MVP] - 16 Oct 2007 17:23 GMT
>In the System::Speech namespace there asychronous methods on both the SR and
>TTS sides. For example, RecognizeAsync( ) and SpeakAsync( ). For the
[quoted text clipped - 35 lines]
>Will both/neither of these methods work? Assuming it is possible, what is
>the way typically used?
The function that is executed asynchronously should do the try/catch. You
can write a wrapper function for this if need be.

Signature
Doug Harrison
Visual C++ MVP
Ben Voigt [C++ MVP] - 16 Oct 2007 17:39 GMT
> In the System::Speech namespace there asychronous methods on both the SR
> and TTS sides. For example, RecognizeAsync( ) and SpeakAsync( ). For the
[quoted text clipped - 35 lines]
> Will both/neither of these methods work? Assuming it is possible, what is
> the way typically used?
I would not expect either method to work.
Catch the exception in the debugger and find out what thread it appears on.
If it isn't a thread you created, I don't think you will be able to
interpose an exception handler.
> Thanx!
>
> [==Peter==]
Peter Oliphant - 21 Oct 2007 03:37 GMT
I think this approach might work. I can't test it since the problem I had is
now gone:
main()
{
try
{
// application code
}
catch(...)
{
// process error
}
return 0 ;
}
[==Peter==]
>> In the System::Speech namespace there asychronous methods on both the SR
>> and TTS sides. For example, RecognizeAsync( ) and SpeakAsync( ). For the
[quoted text clipped - 45 lines]
>>
>> [==Peter==]