0

I am attempting to connect to SolidWorks via this code:

Dim swApp As SolidWorks.Interop.sldworks.ISldWorks = _
    TryCast(System.Runtime.InteropServices.Marshal.GetActiveObject("SldWorks.Application.34"), SolidWorks.Interop.sldworks.ISldWorks)

The connection works just fine and dandy when everything is fresh. It seems that if SolidWorks has been open overnight, this call fails with this exception:

Operation unavailable (Exception from HRESULT: 0x800401E3 (MK_E_UNAVAILABLE))

If I restart SolidWorks, everything begins working as expected.

Any ideas why this is throwing an error?

1
  • GetActiveObject uses COM's Running Object Table (ROT). Next time you get the MK_E_UNAVAILABLE error, use a tool (like these) to view the contents of the ROT, which should help you identify the problem. Commented Oct 1 at 0:37

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.