读书人

在组件中怎么抛出这个错误 _com_error

发布时间: 2012-01-24 23:11:55 作者: rapoo

在组件中如何抛出这个异常 _com_error?
在使用组件时可以通过
try{
}catch(_com_error e){
}
来捕获异常。

想知道,在组件中如何抛出这个异常 _com_error?


[解决办法]
搜索 IErrorInfo 接口
[解决办法]
组件:
To return error information
1 Implement the ISupportErrorInfo interface.
2 To create an instance of the generic error object, call the CreateErrorInfo function.
3 To set its contents, use the ICreateErrorInfo methods.
4 To associate the error object with the current logical thread, call the SetErrorInfo function.

客户端:
_com_error类会自动获取错误,看看这个类的源代码。

读书人网 >VC/MFC

热点推荐