-
ATL exception handling
hi gang ;
i suppose ATL projects don't support mfc or standard c++ exception handling .
it took me a while tracking my project finding ATL encoding runtime error like while i wanted to wrapp a piece of ATL codes around standard c++ try cath clause.
however i couldn't use __try __except caluse due to stack unwinding problem .
now i'm wondering if anyone can tell me how to power my ATL code with exception handling.
thanks in advanced.
-
>> i suppose ATL projects don't support mfc or standard c++ exception handling
Sure you can, on both accounts.
However, using MFC in an ATL project is more "advanced" subject and should only be attempted if you really know MFC and how it works under the hood.
>> however i couldn't use __try __except caluse due to stack unwinding problem
Structured Exception Handling (SEH) is an MSVC specific feature for catching hardware and software exceptions (like bus errors or divide by 0).
If you want to put SEH around code which requires "object unwinding", then you have to put that code in a function and wrap the function......ie
Code:
__try
{
foo();
}
...
gg