_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 }