
use dlls created with vc++ in vb
Quote:
> i developed a small dll in vc++ using objects with the default vc++ dll
> template
> how can i instance the object in the dll from my vb project
If they're normal C++ objects, that's just not going to work. VB won't
be able to understand them.
You have two options:
- Export global methods that act on objects that are internal to the
DLL. The global methods should be declared as __stdcall. If you
set it up right, you might be able to pass "handles" to internal
objects out to VB, where they are pointers on the C++ side and longs
on the VB side. This would require use of type-casting on the C++
side and consequently you'd lose type safety when they get passed
back to C++ from VB (i.e. if you{*filter*}it up, it's very likely to
GPF on you rather than failing gracefully).
- Export COM objects from the DLL. This is NOT trivial. It's probably
easiest to do it using the ATL and associated wizards. I've never
done it myself, so I shan't offer any advice.