问题描述
您好
在Visual C ++ 2008中调试程序时,我得到一个异常说"Microsoft C ++异常:COleDispatchException在内存位置0x ####"。根据这些信息,我添加了一个try-catch块,如下所示:
When debugging program in Visual C++ 2008, I get an exception said "Microsoft C++ exception: COleDispatchException at memory location 0x####". Based on this info, I add a try-catch block as follows:
尝试
{
...
做点什么
...
}
Catch(COleDispatchException& e)
Catch(COleDispatchException& e)
{
}
但这不会发现异常。然后我从COleDispatchException&更改参数到COleDispatchException *,如下所示:
But this does not catch the exception. Then I change the parameter from COleDispatchException& to COleDispatchException*, as follows:
尝试
{
...
做点什么
...
}
Catch(COleDispatchException * e)
Catch(COleDispatchException* e)
{
}
然后我将能够捕获异常。所以我只是想知道如何预先知道异常类型,以防止花时间猜测类型?
Then I will be able to catch the exception. So I just wonder how to know the exception type beforehand, to prevent taking time to guess the type?
推荐答案
哪个函数抛出异常?
问候,Guido
这篇关于如何确定异常类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!