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: 

Sometimes GetActiveObject does not work...

2 REPLIES 2
Reply
Message 1 of 3
oransen
591 Views, 2 Replies

Sometimes GetActiveObject does not work...

When starting up sometimes GetActiveObject does not get hold of an already running Inventor.

 

I'm testing a program which uses a part which the program assumes is already loaded, but since GetActiveObject fails the whole program fails.

 

What could make GetActiveObject fail if a session is already open?

 

    CLSID InvAppClsid; 
    HRESULT hRes = CLSIDFromProgID (L"Inventor.Application", &InvAppClsid);
    if (FAILED(hRes)) {
        pInvApp = nullptr ;
        return ReturnAndShowCOMError (hRes,L"ConnectToInventor,CLSIDFromProgID failed") ;
    }

    // See if Inventor is already running...
    CComPtr<IUnknown> pInvAppUnk = nullptr ;
    hRes = ::GetActiveObject (InvAppClsid, NULL, &pInvAppUnk);
    if (FAILED (hRes)) {
        // ERROR: Inventor IS running but GetActiveObject fails
        // What can I do to investigate this error?

The COM error code is 0X800401E3.

 

The meaning is "operation not available" (translated from Italian).

 

 

 

Tags (1)
2 REPLIES 2
Message 2 of 3
ekinsb
in reply to: oransen

It's difficult to say what the problem is.  Connecting to Inventor's API using GetActiveObject is all Microsoft functionality.  Are you running on any kind of "special" system?  For example, is it a server?  I've seen some strange behavior before with that.


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

I've investigated further and it seems to be a (known) (Microsoft) problem with the ROT (Running Objects Table). If I get any further with this I'll report back here.

 

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

Post to forums  

Autodesk Design & Make Report