0 Replies Latest reply on Jul 30, 2013 3:59 PM by Louis Bouchard

    Connecting to oem SolidWorks instance, class not registered

    Louis Bouchard

      Hi,

       

      I'm beginning a project for a stand-alone application in either C# or unmanaged C++, in VisualStudio 2012.  I am having trouble obtaining the handle of a solidworks instance.

       

      I have tried the following in c#:

       

      [...]

      Type swType = Type.GetTypeFromProgID("SldWorks.Application");

      ISldWorks app = (ISldWorks)Activator.CreateInstance(swType); // causes REGDB_E_CLASSNOTREG error

      [...]

       

      and in c++, I have tried this:

       

      CLSID clsid;

      HRESULT hres = NOERROR;

      ::CoInitialize(NULL);

      CLSIDFromProgID(OLESTR("SldWorks.Application"), &clsid);

      hres = swApp.CoCreateInstance(clsid, NULL, CLSCTX_LOCAL_SERVER); // hres reports REGDB_E_CLASSNOTREG

      [...]

       

      ... and this:

      CComPtr<ISldWorks> swApp;

      HRESULT hres = swApp.CoCreateInstance(__uuidof(SldWorks::SldWorks), NULL, CLSCTX_LOCAL_SERVER);// hres reports REGDB_E_CLASSNOTREG

      [...]

       

      So clearly, the code is not the problem, just one or more DLL aren't registered.

       

      The version of SolidWorks I am using is actually an OEM version of SolidWorks that comes packaged with OptisWorks 2013 64bit.  I understand from the information I gathered that there are a few hoops to jump through when trying to work with x64 machines, and I have setup my VS projects accordingly, but it still doesn't work.

       

      It seems I would have to manually register some DLLs with regsvr32, but which one(s)?  All of them? There are quite a few.  But even that fails: I have tried to register the file solidworks.interop.sldworks.dll, but it complains that 'the entry-point DLLRegisterServer was not found'.

       

      I have always progammed in linux environments before, I am not very familiar with the inner workings of windows yet.

       

      any help would be appreciated.

       

      Louis