?? stcomerror.cpp
字號:
#include "stdafx.h"
#include "STComError.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// CSTComError
//////////////////////////////////////////////////////////////////////
CSTComError::CSTComError()
: m_hrError(S_OK)
{
}
CSTComError::CSTComError(HRESULT hrError)
: m_hrError(hrError)
{
}
CSTComError::CSTComError(const CSTComError &src)
: m_hrError(src.m_hrError)
{
}
CSTComError& CSTComError::operator=(const CSTComError &src)
{
m_hrError = src.m_hrError;
return *this;
}
HRESULT CSTComError::Error() const
{
return m_hrError;
}
CSTComError lastComError;
CSTComError GetComError()
{
return lastComError;
}
//////////////////////////////////////////////////////////////////////
// COM error handlers
//////////////////////////////////////////////////////////////////////
void __stdcall _com_issue_error(HRESULT hResult)
{
#ifndef ST_IGNORE_COM_EXCEPTIONS
DWORD *data = new DWORD[1];
data[0] = hResult;
RaiseException(EXCEPTION_COMERROR, 0, 1, data);
#endif /*ST_IGNORE_COM_EXCEPTIONS*/
}
void __stdcall _com_issue_errorex(HRESULT hResult, IUnknown* pUnknown, REFIID refid)
{
#ifndef ST_IGNORE_COM_EXCEPTIONS
DWORD *data = new DWORD[1];
data[0] = hResult;
RaiseException(EXCEPTION_COMERROR, 0, 1, data);
#endif /*ST_IGNORE_COM_EXCEPTIONS*/
}
int ComErrorFilterFunction(DWORD dwCode, LPEXCEPTION_POINTERS info)
{
HRESULT hrResult = info->ExceptionRecord->ExceptionInformation[0];
lastComError = CSTComError(hrResult);
return (dwCode==EXCEPTION_COMERROR);
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -