How to catch exception from third party component?

Hi,

Is there a way to catch the exceptions thrown from the third party component.

The case like:

1. I create a new object obj,

2. I call obj.start() function. this MAY start several threads in the object. the start method will return right away.

3. let the application run for a while.

4. somthing wrong in the obj's thread,

I want to catch the exception from the point 4 to avoid the crash of my program.

I have no idea about the thread in the obj, again, it is from 3th party.

All comments are welcome.

Thanks

[582 byte] By [SmallRat] at [2007-12-22]
# 1

Have you tried using an unhandled exception handler? This is hooked in by adding a handler to the ThreadException event on the Application object prior to invoking Application.Run

static void Main()
{

Application.ThreadException += new ThreadExceptionEventHandler(
Application_ThreadException);

Application.Run(new Form1());
}

The code to work with the exception is now placed into the Application_ThreadException method.

Hope that helps.

BJohnson at 2007-8-30 > top of Msdn Tech,Visual C#,Visual C# General...
# 2
I tried this already, it doesn't work!
SmallRat at 2007-8-30 > top of Msdn Tech,Visual C#,Visual C# General...
# 3
So then how does your application crash?
BJohnson at 2007-8-30 > top of Msdn Tech,Visual C#,Visual C# General...
# 4
the application will exit without any signal to me. the only thing i know about the obj is that the obj is using directx.
SmallRat at 2007-8-30 > top of Msdn Tech,Visual C#,Visual C# General...