Link to home
Start Free TrialLog in
Avatar of redbaron082997
redbaron082997

asked on

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++?
ASKER CERTIFIED SOLUTION
Avatar of chensu
chensu
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mirkwood
Mirkwood

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.

Avatar of redbaron082997

ASKER

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.
One of the advantages using ActiveX controls is language neutral. You may use any programming language to write it.
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
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.