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