问题描述
大家好,
我有一个很大的问题,希望能得到你的帮助。我有一个名为 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)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!