Valshnar
Mechanical
- May 12, 2003
- 13
I'd like to add a button to turn the PDMWorks addin on and off so we can share licenses better...I have code that works fine for this on my box but I must make it universal. Looks like there are several places that the addin .dll could be located, especially with XP64 boxes. How can I find this live so that the program runs no matter where the .dll was installed?
Thanks!
My code below;
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim SWAPP As Object
Dim RetVal As Long
Const strAddInPath As String = "C:\Program Files\SolidWorks\PDMWorks Client\pdmwaddin.dll"
' SWAPP = Application.SldWorks
SWAPP = GetObject(, "SldWorks.Application")
If Not SWAPP Is Nothing Then
RetVal = SWAPP.LoadAddIn(strAddInPath) 'Load Add in
If RetVal = 2 Then 'add in already loaded
'Unload the add in
SWAPP.UnloadAddIn(strAddInPath)
End If
End If
Thanks!
My code below;
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim SWAPP As Object
Dim RetVal As Long
Const strAddInPath As String = "C:\Program Files\SolidWorks\PDMWorks Client\pdmwaddin.dll"
' SWAPP = Application.SldWorks
SWAPP = GetObject(, "SldWorks.Application")
If Not SWAPP Is Nothing Then
RetVal = SWAPP.LoadAddIn(strAddInPath) 'Load Add in
If RetVal = 2 Then 'add in already loaded
'Unload the add in
SWAPP.UnloadAddIn(strAddInPath)
End If
End If