I am currently making a application that has several reference DLL and i am trying to add these references on runtime. how can i make this posible in vb6?
Please help me with my problem and share me code or link for reference. i highly appreciate it. thanks!
I might be wrong, but as long as the dll is registered (regsvr32), you should be able to load classes from it using the CreateObject("Class Identifier") method
Related
I'm working on a Solidworks Addin using VB.NET that utilizes the Solidworks API and CAMWorks API.
Basically, Solidworks has integrated a free version of CAMWorks dubbed "SolidworksCAM". The API dll reference for CAMWorks and SolidworksCAM are different, each with a unique GUID, but maintaining the same simple name of "Interop.CAMWorksLib.dll". The API functions are 100% the same, just each software ships with a different GUID for their API. This GUID ties back to the COM assembly loaded in Solidworks, so if Solidworks has SolidworksCAM loaded and my addin is complied with the CAMWorks API reference it will fail to retrieve the COM object.
How can I achieve compatibility between these two APIs without having two projects? Is it even possible? Thanks!
Whenever I post a question to a board it seems like I always solve it soon after.
For future reference, I used Reflection to dynamically load the Dlls. Below is some more detailed information.
I put the Dlls in two different folders in my project and set them to Copy. I then used Assembly.LoadFile to load the dll and get its assembly. I used this assembly to get the constructor class "CWAppClass" and fed its type into Activator.CreateInstance to get an instance of the main CWApp class. This way you can use whichever one doesn't error. Thanks for the help!
After taking advice to not use LoadFile(), i have found that there is a method in the Solidworks API that allows you to do this. By using Sldworks::GetAddInObject you can get the addin object for whichever addin you choose. Then you can use the CAMWORKSADDINLib to interact with this. Thanks for the suggestion, this it the perfect solution for my problem.
I am attempting to add a reference to System.DirectoryServices in my VBA application, but cannot seem to find the reference to add. Any help? I have a dll I used with my .NET C# app and I tried adding a copy it as a reference, but it was unable to add (I suspected it might not work, but worth a try). What reference is needed and where is it found for use of DirectoryServices in VBA?
Thanks in advance!
I believe it is the "Active DS Type Library". The prefix is then ActiveDs.
*Note that this is not the .NET library.
I am supposed to do a IVR project using Pronexus. After downloading their DLLs, my code hit COMExceptions regularly. I have searched the net and learned about Component Object Model. Now I am in trouble as I do not know how should I write my codes to extend from the DLLs that is accessing unmanaged codes.
So my question is, can someone point me to a direction how can I proceed from here? Should I learn how to code with COM libraries? Any good sources to recommend?
Found a clue from msdn.microsoft.com/en-us/library/ms973872.aspx (good read for developer new to Component Object Model)
so my question is relatively simple, can I create VB6 application that references a class in a dll, and then substitute that dll for another at runtime?
Now my intial guess is... no chance in VB6.
So my thoughts turned to a VB.net interop dll. Could I do it in here, and then call the interop dll from the VB?
Again, my guess would be no.... but I'd be happy if someone knew differently.
The only thing that I think would actually work would be DI in .Net, but I'm limited to .net 2, or 3.5 at a big push, so I dont know if that is possible.
So for the background....
I have a dll that a specific site uses, but we dont want to ship that out to everyone. Instead, we want to build a clone dll which just has the interfaces setup so that the VB6 build will complete.
When it gets to the site that needs it, they want to replace the dummy dll, and drop in their version instead.
Note: We do use RegFreeCOM when its gets installed, so I do have the manifest files that I could play around with if needed.
Any ideas would be much appreciated.
Nick
Its a COM dll so its not statically linked to the VB6 exe, so long as the clsids and interface ids are the same in the type library for both DLLs, you can swap them around as you see fit. (If its a VB6 dll this is trivial to do with the 'binary compatibility' build option)
You could also use late binding instead and instead of making a reference directly in your VB6 code, you would create an object and then set that object to an instance.
Examples and information:
MVPS
Microsoft
Is there any way to reference a tlb export on Mono?
I am really stuck with .NET on one of my only remaining projects on MS platforms and would like to move away from it. The only problem is that the web site is dependent on a COM library that is simply a socket wrapper enforcing a messaging protocol. I could reverse the code (I actually made a 10k line attempt) but there's nothing better than the original if it works.
Any advice would be greatly appreciated. Thanks in advance!
EDIT:
The link is much appreciated, but I noticed a reference to xptimport but nothing more. Anyone know of a way to currently implement a COM reference in Mono for a non-Windows machine?
COM Interop in Monohttp://www.mono-project.com/COM_Interop