With this code (just as an example) I can check the HRESULT value:
CComPtr<ExtrudeFeature> pExtrude; hRes = pExtrudeFs->Add (pExtrudeDef); if (FAILED(hRes)) { _tprintf_s (_T("AddSolid but could Add ExtrudeDefinition\n")); return hRes ; }
I can see that some HRESULT values are defined by Microsoft, but it looks like some values may be defined by Inventor? Is that true or are all the HRESULT values from the Inventor API just already defined MicroSoft values (like E_FAIL or E_ABORT etc)?
I ask because this page
seems to suggest that other applications can add their own return codes.
(In either case I'd like to find or make a function which would give string values for the error. I'll post the C++ code here if I ever do it.)
Solved! Go to Solution.
Solved by ekinsb. Go to Solution.
Inventor is using the Microsoft defined HRESULT values.
Thanks for the reply. So to get deeper error messages I'd have to use a function something like the one below?
static void ShowErrors (const CComPtr<Application>& pInvApp) { CComPtr<ErrorManager> pErrorManager; HRESULT hr = pInvApp->get_ErrorManager (&pErrorManager) ; if (FAILED (hr)) { // Display some information about Inventor _tprintf_s(_T("Could not get error manager\n")); } CComBSTR bstrErrMessages; hr = pErrorManager->get_AllMessages(&bstrErrMessages) ; if (FAILED (hr)) { _tprintf_s(_T("Could not get error messages\n")); } else { VARIANT_BOOL bErrors ; pErrorManager->get_HasErrors (&bErrors) ; if (bErrors == VARIANT_TRUE) { _tprintf_s(_T("Error messages:<%s>\n"),bstrErrMessages); } else { _tprintf_s(_T("The manager has no messages\n")); } } }
I haven't had time to test it deeply, so any comments would be welcome.