1 Reply Latest reply on Aug 26, 2013 12:13 PM by Aj Jones

    Starting SolidWorks 2013 in API. Now no files open when double clicked

    Aj Jones

      I have the following code in a program:

       

      )

      swApp = CreateObject("SldWorks.Application")
      swApp.UserControl = True
      swApp.Visible = True

      It works fine to open SolidWorks.  Now if I try opening any SolidWorks part by double clicking on it on my desktop or the network they do nothing.  I went into SolidWorks and ran the "Restore All File Associations" and it still does this.  I also tried SldWorks.Application.21 in the create object.  We recently upgraded from 2012 to 2013. In 2012 it never did this.   SolidWorks files will open just fine if I go to file > open > and select them.  If SolidWorks is already open, then it connects with that instance of SolidWorks and works fine.  If anyone knows a way to fix this I would appreciate it.  Thanks.

       

       

        • Re: Starting SolidWorks 2013 in API. Now no files open when double clicked
          Aj Jones

          The only thing I've come up with that works is if I do the following:

           

                  Dim p() As Process
                  p = Process.GetProcessesByName("SLDWORKS")
                  If p.Count > 0 Then
                  Else
                      Process.Start("C:\Program Files\SolidWorks Corp\SolidWorks\SLDWORKS.exe")
                      System.Threading.Thread.Sleep(2000)
                  End If

                  swApp = CreateObject("SldWorks.Application")
                  swApp.UserControl = True
                  swApp.Visible = True

           

          If I don't put the 2 second sleep, then it does the same thing it was doing.  I tried putting in 1 second, and that didn't work either.  Other people are using this application with different computer specs, so I'm worried that the 2 second sleep won't work for every computer.  This is a temporary fix, but I still need a better way than this.