ATL错误处理

_com_issue_error(HRESULT x)

throw a _com_error object

 1 try
 2 {
 3     HRESULT hr;
 4     ...
 5     if (FAILED(hr))
 6          _com_issue_error(hr);    
 7 }
 8 catch(_com_error & e)
 9 {
10     ...
11     cout << "HRESULT message is" << e.ErrorMessage() << endl;
12     if (e.ErrorInfo())
13         cout << e.Description() << endl;
14     return -1;  
15 }

 

posted on 2014-06-04 09:24  aoun  阅读(188)  评论(0编辑  收藏  举报