Hi Everybody!
I need to develop some functions in C++.NET DLL and share it to Visual
Basic 6.0, which is the best path to create a C++ DLL an then use that
function later...?
I appreciate some help.
Thank you
Carlos Villaseñor M.
Marcus Heege - 11 Jul 2006 14:08 GMT
Option 1: export a function normally and use the declare statement in VB6
Option 2: Write a COM object (e. g. in ATL) and add a reference to the TLB
in your VB6 project
For the first one, the C++ lib is easier to implement and the VB6 client is
more difficult to implement. If you go for the other option it is just the
opposite.
Marcus
> Hi Everybody!
>
[quoted text clipped - 6 lines]
> Thank you
> Carlos Villaseñor M.
William DePalo [MVP VC++] - 11 Jul 2006 14:17 GMT
> I need to develop some functions in C++.NET DLL and share it to Visual
> Basic 6.0, which is the best path to create a C++ DLL an then use that
> function later...?
You don't say whether this DLL contains native or managed code. If the code
is managed (i.e. it targets the .Net platform) then the DLLs you make with
VS are assemblies whcih contain classes. Those classes can appear to be COM
objects to the likes of VB if you "register" the assembly.
This link descrribes the registration tool, regasm:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cptools/html/cp
grfAssemblyRegistrationToolRegasmexe.asp
If the code in the DLL is native, I'd suggest you build a COM object because
COM was invented for VB (GD&R). To that end you could use ATL to take some
of the sting out of COM development. This page may help to get you started:
http://www.codeproject.com/atl/com_atl.asp
Regards,
Will