• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ _com_error类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中_com_error的典型用法代码示例。如果您正苦于以下问题:C++ _com_error类的具体用法?C++ _com_error怎么用?C++ _com_error使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了_com_error类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: msg

void
task::error_reply( const _com_error& e, const std::string& method )
{
    _bstr_t msg( _bstr_t(L"Error: ") + e.Description() + L": " + e.ErrorMessage() );
    for ( auto& reply: reply_handlers_ )
        reply( method, static_cast< const char *>( msg ) );
}
开发者ID:hermixy,项目名称:qtplatz,代码行数:7,代码来源:digitizer.cpp


示例2: PrintErrorInfo

/*打印错误消息*/
void CDBOperation::PrintErrorInfo(_com_error &e){
	std::cout << "Error information are as follows" << std::endl;
	std::cout << "ErrorNo: " << e.Error() << std::endl;
	std::cout << "Error Message :" << e.ErrorMessage() << std::endl;
	std::cout << "Source : " << e.Source() << std::endl; 
	std::cout << "Error Description : " << e.Description() << std::endl;
}
开发者ID:huanghao870620,项目名称:myproj,代码行数:8,代码来源:CDBOperation.cpp


示例3: HandleComErrorException

//*****************************************************************************
//* Function Name: HandleComErrorException
//*   Description: Handle a _com_error exception. This routine is called from
//*                catch blocks for _com_error exceptions.
//*****************************************************************************
HRESULT HandleComErrorException (
	LPCTSTR				p_lpszFile,
	UINT				p_uLine,
	const _com_error&	p_ce)
{
	(void) HandleFacilityInternetComErrorException (p_ce);

	// Preserve the logical thread's error object. This is cleared when
	// _com_issue_error[ex] calls the Automation ::GetErrorInfo() function.

	// Attach the raw interface pointer returned by _com_error::ErrorInfo()
	// to our smart pointer. _com_error::ErrorInfo() AddRef's the raw
	// interface pointer that it returns. We want to encapsulate this
	// raw interface pointer in a smart pointer without performing an
	// additional AddRef.
	IErrorInfoPtr l_spErrorInfo (p_ce.ErrorInfo (), false /* fAddRef */);

	if (l_spErrorInfo) {
		// There is one reference to the error object in p_ce. There is another
		// reference in l_spErrorInfo. Both of these references will be released
		// by the time we leave the caller's catch block. The COM run-time's
		// reference to the error object will have been cleared when
		// _com_issue_error[ex] was called. By calling SetErrorInfo(),
		// we preserve the logical thread's error object.
		(void) ::SetErrorInfo (0 /* dwReserved */, l_spErrorInfo);
	}

	return p_ce.Error ();
}
开发者ID:taylorjg,项目名称:WineApi_CXX,代码行数:34,代码来源:ComErrorHandling.cpp


示例4: OutputDBErrMsg

void CNHSQLServerDBO::OutputDBErrMsg(const _com_error& e)
{
    const int nErrMsgLength(MAX_PATH);
    wchar_t *pwchErrMsg = new wchar_t[nErrMsgLength]();
    _snwprintf_s(pwchErrMsg, nErrMsgLength, _TRUNCATE, L"错误编号:%08lx  错误信息:%s  错误源:%s  错误描述:%s",
                 e.Error(),
                 e.ErrorMessage(),
                 (LPCWSTR)e.Source(),
                 (LPCWSTR)e.Description());

    // 输出错误信息到输出窗口
    OutputDebugStringW(L"\t");
    OutputDebugStringW(pwchErrMsg);
    OutputDebugStringW(L"\n");
    // 输出错误信息到日志文件
    if (0 != wcscmp(m_wchLogFilePath, L""))
    {
        // 当日志文件路径不为空时,写日志
        CNHLogAPI::WriteLogEx(m_wchLogFilePath, LOG_ERR, L"NHSQLServerDBO", pwchErrMsg);
    }

    if (NULL != pwchErrMsg)
    {
        delete[] pwchErrMsg;
        pwchErrMsg = NULL;
    }
}
开发者ID:musclecui,项目名称:Solution1,代码行数:27,代码来源:NHSQLServerDBO.cpp


示例5: ExceptionInfo

void CFoxBase::ExceptionInfo(_com_error &e)
{
	if(e.Description().length()>0)
		ExceptionInfo(e.Description());
	else
		ExceptionInfo(e.ErrorMessage());
}
开发者ID:uesoft,项目名称:AutoIPED,代码行数:7,代码来源:FoxBase.cpp


示例6: dump_com_error

void CADO::dump_com_error(_com_error &e)
{
	_bstr_t bstrSource(e.Source());
	_bstr_t bstrDescription(e.Description());
	g_logger.error("ADO Error Code = %08lx Code meaning = %s Source = %s Description = %s",
		e.Error(), e.ErrorMessage(), (LPCTSTR)bstrSource, (LPCTSTR)bstrDescription);
}
开发者ID:felove2013,项目名称:felove_2015,代码行数:7,代码来源:zADO.cpp


示例7: on_excetion

void HiDBOracle::on_excetion(const char* name, const char* sql, _com_error &e)
{
	_bstr_t bstrSource(e.Source());
	_bstr_t bstrDescription(e.Description());
	stringstream oss;
	oss<<"source:"<<bstrSource<<"\nDescription:"<<bstrDescription<<"\nerror message:"<<e.ErrorMessage();
	HiDBHelperOnError("HiDBOracle::ExecuteQuery", oss.str().c_str(), sql, e.Error());	
}
开发者ID:xumingxsh,项目名称:HiDB,代码行数:8,代码来源:HiDBOracle.cpp


示例8: ErrorHandler

static void ErrorHandler(_com_error &e, char* ErrStr)			
{
	sprintf(ErrStr,"Error:\n");
	sprintf(ErrStr,"%sCode = %08lx\n",ErrStr ,e.Error());
	sprintf(ErrStr,"%sCode meaning = %s\n", ErrStr, (char*) e.ErrorMessage());
	sprintf(ErrStr,"%sSource = %s\n", ErrStr, (char*) e.Source());
	sprintf(ErrStr,"%sDescription = %s",ErrStr, (char*) e.Description());
}
开发者ID:radtek,项目名称:aitop,代码行数:8,代码来源:CDataBase.cpp


示例9: DbError

void DbError(_com_error &e)
{
	_bstr_t bstrSource(e.Source());
	_bstr_t bstrDescription(e.Description());
      
	CUString msg;
	msg.Format("\n\tSource :  %s \n\tdescription : %s \n ",(LPCSTR)bstrSource,(LPCSTR)bstrDescription);

	MessageBox(NULL, msg, "", MB_OK);
}
开发者ID:sigurdle,项目名称:FirstProject2,代码行数:10,代码来源:WebSite_old.cpp


示例10: dump_com_error

void dump_com_error(_com_error &e)
{
	wprintf(L"Error\n");
	wprintf(L"\a\tCode = %08lx\n", e.Error());
	wprintf(L"\a\tCode meaning = %s", e.ErrorMessage());
	_bstr_t bstrSource(e.Source());
	_bstr_t bstrDescription(e.Description());
	wprintf(L"\a\tSource = %s\n", (LPCSTR) bstrSource);
	wprintf(L"\a\tDescription = %s\n", (LPCSTR) bstrDescription);
}
开发者ID:kravietz,项目名称:TSLwatch,代码行数:10,代码来源:parseRootTsl.cpp


示例11: dump_com_error

void dump_com_error(_com_error &e)
{
    _tprintf(_T("Oops - hit an error!\n"));
    _tprintf(_T("\a\tCode = %08lx\n"), e.Error());
    _tprintf(_T("\a\tCode meaning = %s\n"), e.ErrorMessage());
    _bstr_t bstrSource(e.Source());
    _bstr_t bstrDescription(e.Description());
    _tprintf(_T("\a\tSource = %s\n"), (LPCTSTR) bstrSource);
    _tprintf(_T("\a\tDescription = %s\n"), (LPCTSTR) bstrDescription);
}
开发者ID:Jinjiego,项目名称:VCSamples,代码行数:10,代码来源:commail.cpp


示例12: dump_com_error

static 	void dump_com_error(_com_error &e)
{
	::AtlTrace("Error\n");
	//TRACE1("\a\tCode = %08lx\n", e.Error());
	//TRACE1("\a\tCode meaning = %s", e.ErrorMessage());
	_bstr_t bstrSource(e.Source());
	_bstr_t bstrDescription(e.Description());
	::AtlTrace("\a\tSource = %s\n", (LPCSTR) bstrSource);
	::AtlTrace("\a\tDescription = %s\n", (LPCSTR) bstrDescription);
}
开发者ID:amanrenishaw,项目名称:MTConnectGadgets,代码行数:10,代码来源:ResourceIntegrator.cpp


示例13: GetError

CString GetError(_com_error &e)
{	
	CString MsgBug;
	_bstr_t Source(e.Source());
	_bstr_t Description(e.Description());
	MsgBug.Format( "Ups!!! \nSource = %s\nDescription= %s\n",(LPCSTR)Source, (LPCSTR)Description );
	#ifdef _DEBUG
		AfxMessageBox( MsgBug, MB_OK | MB_ICONERROR );
	#endif	
	return MsgBug;
}
开发者ID:darwinbeing,项目名称:trade,代码行数:11,代码来源:GuiADODB.cpp


示例14: dump_com_error

void dump_com_error(_com_error &e)
{ 
	CString strError;

	_bstr_t bstrSource(e.Source());
	_bstr_t bstrDescription(e.Description());
	// Print Com errors. 
	strError.Format(_T("Database Engine Error\n\nCode  %08lx\nmean:%s\nSource: %s\nDescription: %s\n"),
		e.Error(), e.ErrorMessage(), (LPTSTR) bstrSource, (LPTSTR) bstrDescription);
	AfxMessageBox(strError,MB_OK+MB_ICONERROR); 
}
开发者ID:eseawind,项目名称:CoalQualityTestSystem,代码行数:11,代码来源:StdAfx.cpp


示例15: ErrCom

// ErrCom Function
void ErrCom(_com_error &e)
{
	_bstr_t bstrSource(e.Source());
	_bstr_t bstrDescription(e.Description());
	
	// Print Com errors.  
	printf("Error\n");
	printf("\tCode = %08lx\n", e.Error());
	printf("\tCode meaning = %s\n", e.ErrorMessage());
	printf("\tSource = %s\n", (LPCSTR) bstrSource);
	printf("\tDescription = %s\n", (LPCSTR) bstrDescription);
}
开发者ID:GALICSOFT,项目名称:glc220_src,代码行数:13,代码来源:LnNetOledb.cpp


示例16: PrintComError

void PrintComError(_com_error &e)
{
	_bstr_t bstrSource(e.Source());
	_bstr_t bstrDescription(e.Description());

	// Print COM errors. 
	PTRACE(1, "catch _com_error:\tError = " << e.Error()
		<< "\tErrorMessage = " << (const char*)e.ErrorMessage()
		<< "\tSource = " << (const char*)bstrSource
		<< "\tDescription = " << (const char*)bstrDescription
		);
}
开发者ID:princetoad,项目名称:callback,代码行数:12,代码来源:database.cpp


示例17: dump_com_error

//打印调用ADO控件时产生的详细错误信息
void LoadManage::dump_com_error(_com_error &e)
{
	CString ErrorStr;
	_bstr_t bstrSource(e.Source());
	_bstr_t bstrDescription(e.Description());
	ErrorStr.Format( "/n/tADO Error/n/tCode = %08lx/n/tCode meaning = %s/n/tSource = %s/n/tDescription = %s/n/n",
		e.Error(), e.ErrorMessage(), (LPCTSTR)bstrSource, (LPCTSTR)bstrDescription );
	//在调试窗口中打印错误信息,在Release版中可用DBGView查看错误信息
	::OutputDebugString((LPCTSTR)ErrorStr);
#ifdef _DEBUG
	AfxMessageBox(ErrorStr, MB_OK | MB_ICONERROR);
#endif	
}
开发者ID:Strongc,项目名称:Mobis,代码行数:14,代码来源:LoadManage.cpp


示例18: ComCatch

/**
 * Used in the catch block for a catched _com_error exception to
 * set the error information object with ::SetErrorInfo and returning
 * the HRESULT error code the corresponds with the exception.
 * If the exception _com_error object holds a error information object
 * exposing the interface IErrorInfo, ::SetErrorInfo with that object
 * will be called.
 * @param   _com_error exceptional object.
 * @return  error code associated with the _com_error object.
 * @exception       -
 * @see ::SetErrorInfo.
*/
HRESULT ComCatch(_com_error & err)
//catches thrown _com_error and sets error info for interface method
//call if available
{
    IErrorInfo* pei;
    pei = err.ErrorInfo();
    if(pei) {
        ::SetErrorInfo(0,pei);
        //do not release it, that is the task of the _com_error class
    }

    return err.Error();
}
开发者ID:LM25TTD,项目名称:ATCMcontrol_Engineering,代码行数:25,代码来源:dlext.cpp


示例19: dump_com_error

void CADORecordset::dump_com_error(_com_error &e)
{
    TCHAR ErrorStr[1024];
    _bstr_t bstrSource(e.Source());
    _bstr_t bstrDescription(e.Description());
    swprintf(ErrorStr,sizeof(ErrorStr)/sizeof(ErrorStr[0]),
        _T("CADORecordset Error\r\nCode = %08lx\r\nCode meaning = %s\r\nSource = %s\r\nDescription = %s\r\n"),
        e.Error(),
        e.ErrorMessage(),
        (LPCTSTR)bstrSource,
        (LPCTSTR)bstrDescription );
    m_strLastError  = _T("Query = ") + GetQuery() + _T('\r\n') + ErrorStr;
    m_dwLastError   = e.Error();
}
开发者ID:lidongqiang,项目名称:wvpctool,代码行数:14,代码来源:ado2.cpp


示例20: GetComErrorDesc

CString GetComErrorDesc(_com_error e)
{
	HRESULT code = e.Error();
	if(code == TYPE_CAST_ERROR)
		return _T("[VARIANT CAST] type doesn't match");
	else
	{
		IErrorInfo* pei = e.ErrorInfo();
		if(pei)
			return (LPCTSTR)e.Description();
		else
			return e.ErrorMessage();
	}
}
开发者ID:zhangtianshan,项目名称:vc-common-src,代码行数:14,代码来源:VarConv.cpp



注:本文中的_com_error类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ _dgbmatrix类代码示例发布时间:2022-05-31
下一篇:
C++ _bstr_t类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap