API: SolidWorks Add-ins and the Registry

Version 7

    The SolidWorks add-in templates register your add-ins at compile time.

     

    From a command window you can manually register your add-in with:

     

        regsvr32 yourDLL.dll


    And unregister it with:

     

        regsvr32 /u yourDLL.dll


    Most installation programs like InstallShield handle registration and unregistration for you.

     

    The availability of SolidWorks add-ins is controlled by registry keys under:


      HKLM\Software\SolidWorks\Addins

    The loading behavior of SolidWorks add-ins is controlled by registry keys under:


      HKCU\Software\SolidWorks\AddinsStartup

     

    A value of 1 for the Default key indicates that the add-in is activated.

    These keys should be removed when you un-register your add-in.

    You can inspect the registry by typing in a command window:

     

          regedit

     

     

    x64:

     

    The process of registering a DLL on Windows x64 is the same as Windows x32 with one exception:

    On Windows x64, there are 2 views on the registry:

    • a 64-bit view, which is the real view
    • a 32-bit view, which is represented by a set of special keys in the 64-bit view that are named Wow6432Node

     

    64-bit applications read from and write to the 64-bit registry view.

    32-bit applications read from and write to the 32-bit registry view.

     

    SolidWorks x64 is a native 64-bit application, so it looks for add-ins in the 64-bit registry view:

    • HKEY_LOCAL_MACHINE\SOFTWARE\SolidWorks\AddIns
    • HKEY_CURRENT_USER\Software\SolidWorks\AddInsStartup

     

    The 32-bit version of SolidWorks running Windows x64 looks in:

    • HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\SolidWorks\AddIns
    • HKEY_CURRENT_USER\Software\Wow6432Node\SolidWorks\AddInsStartup

     

    To ensure that your add-in registration data ends up in the 64-bit registry view, please use the 64-bit version of the most common registration tools:

    • regsvr32.exe for COM dlls
    • regasm.exe for .NET assemblies registered for COM interoperability

     

    Please refer to the attached screenshots (*.jpg) that show where to find the 32-bit and 64-bit versions of these tools. Please note that the 64-bit version of regsvr32.exe has '32' in its name, which might be confusing.

     

    When installing an add-in using Windows Installer, please consult the Windows Installer user guide for how to set the target registry view for a registry entry.

     

    Note:
    - Subscription Services required for full access.

    - Looking for more API Examples?

     

    Copyright © 2010 Dassault Systèmes SolidWorks Corp. All rights reserved.

    Do not distribute or reproduce without the written consent of Dassault Systèmes SolidWorks Corp.