Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

List of the meanings of the values of HRESULT?

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
oransen
545 Views, 2 Replies

List of the meanings of the values of HRESULT?

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

 

HRESULT structure.

 

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.)

 

2 REPLIES 2
Message 2 of 3
ekinsb
in reply to: oransen

Inventor is using the Microsoft defined HRESULT values.


Brian Ekins
Inventor and Fusion 360 API Expert
Mod the Machine blog
Message 3 of 3
oransen
in reply to: ekinsb

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.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report