AnsweredAssumed Answered

How to get solidworks handle (C#)

Question asked by Jack Qu on Jul 11, 2018
Latest reply on Jul 12, 2018 by Jack Qu

Hello,

In the standalone api of SolidWorks (C#), I use  ISldWorks app = (ISldWorks)Activator.CreateInstance(Type.GetTypeFromProgID("SldWorks.Application")) to create an instance, and use OpenDoc6 to open a file. In my addin program, I try to get this SolidWorks handle by using:  SldWorks app = (SldWorks)System.Runtime.InteropServices.Marshal.GetActiveObject("SldWorks.Application"), but this command does not work. Please give me some advices. Thanks.

My computer: Windows 10, 64 bits, SolidWorks 2018

Outcomes