Calling VB6 Dll From C++

R

Ram

Hey,
I have a Dll I created in VB6 and when I'm trying to use it from C++
using the following code:

MyNS::MyClassPtr obj;
obj = new MyNS::MyClass();

I get the following error:
C2559: Cannot Instantiate An Abstract Class

But when I try and use the same Dll from a VB6 or .Net (using Interop)
application everything works perfectly well!

Any ideas?
Thanks ahead

--Ram
 
J

John Harrison

Ram said:
Hey,
I have a Dll I created in VB6 and when I'm trying to use it from C++
using the following code:

MyNS::MyClassPtr obj;
obj = new MyNS::MyClass();

I get the following error:
C2559: Cannot Instantiate An Abstract Class

But when I try and use the same Dll from a VB6 or .Net (using Interop)
application everything works perfectly well!

Any ideas?
Thanks ahead

--Ram

You are probably meant to use a factory method or class to instantiate
the object. Something like this

// factory class
MyNS::MyClassFactory factory;
MyNS::MyClassPtr ptr = factory.create();

or this

// factory method
MyNS::MyClassPtr ptr = MyNS::MyClass::create();

but without knowing anything about VB6 or .NET I couldn't say precisely
what you need to do, but it's likely to be something on the above lines.

john
 

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. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,236
Members
46,822
Latest member
israfaceZa

Latest Threads

Top