Quote:
Originally posted by jeffchen
Maybe I did not make it very clear. The DLL and the COM component used in my program is developed by third party companies and I can not put a try catch into their code for sure.
No, you've made it clear and I get the problem. And I didn't told you put the try-cach into (see my message - "place a dll function calls in try-catch or __try-__except braces"). It should be the first thing to be tried
Code:
try
{
p3dPartInterface->CallThatBuggyServer();
}
catch( _com_error e )
{
. . .
}
Quote:
A similar example may be the plugins for Internet explorer, such as third party toolbar, BHO etc. They have their own message loop/thread and may throw exception from somewhere that my program can not catch.
The code of this sort should catch all its exceptions by itself. If it's not so this code could not be used in commercial projects (as Marco F said). You might set a topmost handler for unexpected exceptions to make your app pretending be stable but to retrieve some useful information you have to do all your best.
Quote:
In short, the problem I am trying to solve is to avoid the third party DLL/plugin to crash my program. For now, I can catch the exception from their code as unhandled exception but I don't know how to resume from this exception.
Me too. If you kill such thread you leave a bunch of visual controls without correspondent handlers and procedures. I think the only way is to release COM-object (and maybe forget it :))
Quote:
I think if I can terminate the thread that cause the exception and resume to the message loop, the program may be able to work again.
Maybe. And maybe not. Follow the Marco F advice and refer to developer of component.