试试用下面的函数扑捉一下错误,然后再好好分析一下,应该能找到。
/////////////////////////////void OutputComError(_com_error &e)
{
_bstr_t bstrSource(e.Source());
_bstr_t bstrDescription(e.Description());
char bstrOutput[1024]; sprintf(bstrOutput, "Code = %08lx\nCode meaning = %s\nSource = %s\nDescription = %s\n",
e.Error(), e.ErrorMessage(), (LPCSTR) bstrSource, (LPCSTR) bstrDescription);
MessageBox(NULL,(LPCTSTR)bstrOutput, "ADO Com Error !", MB_ICONERROR | MB_OK);
}
////////////////////////////
用法:
try
{ .......
}
catch (_com_error &e)
{
OutputComError(e);
}
/////////////////////////////void OutputComError(_com_error &e)
{
_bstr_t bstrSource(e.Source());
_bstr_t bstrDescription(e.Description());
char bstrOutput[1024]; sprintf(bstrOutput, "Code = %08lx\nCode meaning = %s\nSource = %s\nDescription = %s\n",
e.Error(), e.ErrorMessage(), (LPCSTR) bstrSource, (LPCSTR) bstrDescription);
MessageBox(NULL,(LPCTSTR)bstrOutput, "ADO Com Error !", MB_ICONERROR | MB_OK);
}
////////////////////////////
用法:
try
{ .......
}
catch (_com_error &e)
{
OutputComError(e);
}
解决方案 »
- 生成Release版本时遇到的问题
- 在VC++中用CMSChart实现实时曲线的绘制 问题 请各位师兄师姐多多指教
- 给一个作业分配执行时间,时间间隔为什么是100ns?
- 求救....关于socket客户端发送的错误
- 关于CString::Find操作问题
- SSL与证书:如何验证服务器端的证书?
- Windows休眠后,下次启动时按键不能进BIOS setup
- SetUnhandledExceptionFilter为什么在VS2008无效?
- 丢人啊!!我从上大学时,就开始用VC,工作后也用VC一年多了,可是这次不知为何,这次重装后,VC 无法创建新工程?
- 怎么把属性页上控件的值(比如edit显示的字符串)与ActiveX控件的属性联系起来?
- 为什么在CSDN上发布软件迟迟的不能向网友开放!
- 一个控件没有焦点,但我还是对它发WM_KILLFOCUS,有没有可能系统崩溃?
{}
catch(_com_error * e)
{}
catch(...)
{}