Help required to create an add-in DLL

Discussion in 'SolidWorks' started by Fontaine Guy, Sep 9, 2004.

  1. Fontaine Guy

    Fontaine Guy Guest

    Hello to all,

    I'm trying to write an add-in .DLL for SolidWorks 2004 under Visual Basic 6.

    The .DLL in itself seems to run fine... I've started my project by
    modifying someone else's project (Ray Gorman). Using his .reg files which
    is:

    ===================================
    Windows Registry Editor Version 5.00

    [HKEY_LOCAL_MACHINE\SOFTWARE\Solidworks\AddIns\{8B38509E-DEAD-48EF-8F91-16CE
    B1E9779F}]
    @=dword:00000001
    "Description"="Perform a task..."
    "Title"="Fontaine - OriginalProject"

    ====================================

    and his batch file:

    ====================================
    echo Engineering Studio registration command:
    echo H. Fontaine Ltee - OriginalProject.dll...
    regedit -s OriginalProject.reg
    regsvr32 OriginalProject.dll
    =====================================

    Using this, I'm able to register my .dll in SolidWorks and use it instead of
    the OriginalProject.dll .

    However, the descritpion under the Tools -- Add-in menu is still Fontaine -
    OriginalProject ... Also, I don't want my add-in to replace
    OriginalProject, but to be another different add-in.

    What I've tried to do was to change OriginalProject.reg and
    OriginalProject.dll by my names (TestProject.reg and TestProject.dll).

    As I understand it, the CLSID needs to be unique. I've been able to
    generate a new CLSID using code from:
    http://www.vbaccelerator.com/home/VB/Tips/Create_GUIDs/article.asp
    and I put it in the .reg file.

    However, in SolidWorks, my .dll now appears in the Add-in menu, but when I
    try to activate it (in the add-in menu), SW gives an errors, says it can't
    find a file...

    I'm not sure about this, but I think that the problem lies in the fact that
    nowhere I tell the computer that my new CLSID is linked to the
    TestProject.dll file... Is this the problem? Does the CLSID need to be
    hard-coded somewhere in my VB code?

    Also... Should the CLSID be generated once only in my computer, and each
    user will use that CLSID, or should it be generated on each user computer?

    Note: I intend to distribute my add-in, so it wouldn't look good if the user
    had to start the add-in using the File -- Open fucntion from SolidWorks...
    I'd like to automate the registration process...

    Thank you very much for your help!

    As you may have guessed it, I'm quite new to this add-in and .dll stuff
    (though I'm not too bad in VB, I think...)

    - Fontaine_Guy
     
    Fontaine Guy, Sep 9, 2004
    #1
  2. Markku Lehtola, Sep 9, 2004
    #2
  3. Fontaine Guy

    TheTick Guest

    First, you may be trying too hard. Addins are self-registering if you
    drag-and-drop into SW (or, open the addin file from SW using "File -->
    Open" and setting the file selection filter for addin .dll's).

    I have some tools that may help.

    This one is to purge registry settings of addin data:
    <http://www.esoxrepublic.com/devtools/RegScrubDownload.php>

    Also, a work-in-progress is my add-in from VB .exe project.
    <http://www.esoxrepublic.com/models/>, filename
    "MakeAddinFromExeVB.zip". This may give you some additional clues, as
    well as info about the registry keys you may need.

     
    TheTick, Sep 9, 2004
    #3
  4. Fontaine Guy

    Fontaine Guy Guest

    Hello Markku,

    Thank you for your tutorial... This was quite helpful, as I now may start
    from scratch a project...

    Thanks again.

    - Fontaine Guy
     
    Fontaine Guy, Sep 9, 2004
    #4
  5. Fontaine Guy

    Fontaine Guy Guest

    Hello,

    You may be right, I might have been trying too hard... I still don't know
    exactly how to register an add-in using a batch file (which would still be
    nice), but it is okay to register them with "File / Open".

    I will have a thorough look at your files. Thank you!

    - FontaineGuy

     
    Fontaine Guy, Sep 9, 2004
    #5
  6. also, if you install the SW SDK, you will get a new project type for
    add-ins.

    Evan

     
    Evan T. Basalik, Sep 10, 2004
    #6
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.