Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations cowski on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

how do i find PDMWorks .dll path? 1

Status
Not open for further replies.

Valshnar

Mechanical
Joined
May 12, 2003
Messages
13
Location
US
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




 
You should be able to extract the path from the registry. I looked in my registry and found the path at the following location:
HKEY_CLASSES_ROOT\CLSID\{71AD751E-7226-4843-809A-E568E5A494D9}\InprocServer32

The long string, 71AD751E-7226-4843-809A-E568E5A494D9, is what is known as a globally unique ID (GUID) and is a class ID (CLSID) in this context. It should be consistent across machines within a version or service pack. It may even remain the same across versions.

There also appears to be a VersionIndependentProgID associated with this CLSID, which is PdmwAddin.pdmwAddinApp. I did another search and found that string at: HKEY_CLASSES_ROOT\PdmwAddin.pdmwAddinApp. It has a CLSID sub key which matches the above CLSID. It also has a CurVer sub key with value of PdmwAddin.pdmwAddinApp.1. There exists an HKEY_CLASSES_ROOT\PdmwAddin.pdmwAddinApp.1\CLSID entry which has the same value.

The following appears to be the most robust way of obtaining the path:
Get the value of: HKEY_CLASSES_ROOT\PdmwAddin.pdmwAddinApp\CurVer. I will refer to that as current_version.
Get the value of: HKEY_CLASSES_ROOT\current_version\CLSID. I will refer to that as clsid.
Get the value of: HKEY_CLASSES_ROOT\CLSID\clsid\InprocServer32. This should be the path that you are after.

I have not worked with accessing registry values from VB, but looks like a good article on the topic.

Eric
 
Thanks, Eric! That's a good start for me. A star for you.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top