Load .DLL addin fails

Jan 22, 2004 4 Replies

I'm presently building a .DLL add-in for Solidworks using VB6. In my project, I use an office web component in a new modelview tab (pretty much like in the api fundamentals book) and an OCX control featuring a listview with selectable components that is nested in the feature manager.



Running the program as an EXE is great, the listview control is added and populated and the web component is created. I just can't respond to events (which is normal, I think). But when I compile it into an activeX dll and add it to solidworks, solidworks tells me that it couldn't load it because either the dll or one of it's component is missing.



Any idea why it runs fine when pressing F5 in VB and not when compiled as a dll?



Thanks!



Louis-Philippe


Uhm, just a guess - have you implemented the required SWAddin interface in your ActiveX dll project? If you have, can't you just debug the DLL and see what goes wrong?

-h-

Yeah, I have. I should've mentionned that the .DLL used to work before the inclusion of my ocx control into it. The problem is simply that solidworks won't load the DLL. So I can't debug it at all.

Louis-Philippe

What makes a .dll into a SW Addin?

An addin .dll must have a CLASS module that implements the SW addin type library (swpublished.tlb) along with the usual sldworks.tlb. The Instancing property of the class module must be set to "5-MultiUse". The class module requires at least two procedures "SwAddin_ConnectToSW" and "SwAddin_DisconnectFromSW".

SW doesn't see the .dll when it registers. It sees the class module, makes an instance of it, and uses it to access the rest of the .dll. This is what you see in the registry under HKLM/Software/Solidworks/Addins.

Post back if you would like me to send a sample file.

Regards, Roland Schwarz

Have you tried looking at your addin DLL dependencies with the Visual Studio Tool "Depends"? Depends can often show you whether a component that the DLL relies on is missing.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required