本文介绍了程序崩溃,即使使用Assert(HRESULT)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我有一个很大的问题,希望能得到你的帮助。我有一个名为 pRstEmployDB _RecordsetPtr 变量。在我的代码中,我有一行打开Recordset



Hi all,

I have a big problem that I hope get help from you. I have a _RecordsetPtr variable called pRstEmployDB. In my code I have a line to open the Recordset

pRstEmployDB->Open("SOCIETE", _variant_t((IDispatch *) theApp.pConEmployDB, true),  adOpenStatic, adLockReadOnly, adCmdTable);





问题是当这个功能崩溃时(Acces Violation)它会显示一个messageBox来表示错误发生了,崩溃了。我怎么能抓住错误,所以程序将不再崩溃并被关闭?



我试图使用ASSERT(... == S_OK)但也崩溃了。



我也尝试过这种方式,但没有希望





the probleme is when this fucntion crashes (Acces Violation) it shows a messageBox to say that an error happened and crashes. How could i Catch the error so the program will no longer crashes and be closed?

I tried to use ASSERT(... ==S_OK) but crashes too.

I tried this way too, but no hope

Try
{
 pRstEmployDB->Open("SOCIETE", _variant_t((IDispatch *) theApp.pConEmployDB, true),   adOpenStatic, adLockReadOnly, adCmdTable);
}
catch (CException* e)
{
  return FALSE;
}

推荐答案


这篇关于程序崩溃,即使使用Assert(HRESULT)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-23 06:12