Using an ActiveX DLL

I have an ActiveX DLL written in Visual Basic.  How can I create a class from that DLL and use it in Visual C++?
LVL 1
redbaron082997Asked:
Who is Participating?
 
chensuCommented:
Install the ActiveX control into your system. Go to the Component Gallery of the Visual C++, choose the Registered ActiveX Controls and select that control to insert it into your project. Thus, a wrapper class will be generated.
0
 
MirkwoodCommented:
Goto project menu
choose add component
select your dll
select proxy.

Now you will get a wrapper class.

Other way is to use smart pointers.
Add #import "fdefdsf.tlb"
and now you have like a hidden wrapper class inside your code.

0
 
redbaron082997Author Commented:
will this allow me to create an object that was compiled in VBasic?  I will try this.  I was not sure if VC++ would recognize VBasic DLL's.
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
chensuCommented:
One of the advantages using ActiveX controls is language neutral. You may use any programming language to write it.
0
 
redbaron082997Author Commented:
The activex DLL that I am trying to implement is not an OCX or a control, but rather a CLASS that I create, and execute.  
In VB it would be included in the Reference section, and declared like this:  (ActiveX ProgID = RREG)
public cRReg as RREG.clsRegister
set cRREG = new RREG.clsregister
etc.

I can add controls that I have created, (vb *.ctl files that make the OCX files), but I can not properly reference the above.

Thanks
0
 
chensuCommented:
So, don't use Component Gallery. Use Compiler COM Support that comes with Visual C++ 5.0 or later. By using the #import preprocessor directive, the compiler can read a type library and convert it into a C++ header file that describes the COM interfaces as classes. Look into the Visual C++ Programmer's Guide on Compiler COM Support. There are some Compiler COM Support Samples as well.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.