C++ COM or ActiveX to use in VB.NET

U

unknown;

Hi,

i need to write a module in C++ (unmanaged) witch i can use in VB.NET.
The C++ module doesn't have a GUI.
In VB i need to create an instace of the C++ class. I understand the
only way to do this is to make a COM object from my C++ class.

So i searched on the internet and i found so much different stuff about
Active X, COM, OLE, Automation, ATL that i just don't know where to
start to solve my problem.

for example.. if i create a VB project i can add a COM reference (right
click on project -> add refference) and use it in my code like:
Dim Excel As Excel.Application
Excel = New Excel.Application
this is what i want. how do i create such a COM object in C++

all i can find is that i need to use CoCreateInstance to get a pointer
to my CoClass from the COM object
and about QueryInterface, release and the IUnknown interface but when i
create an instance of my the Excel application COM object i don't.. i
don't understand

I understand that there are more than one ways to create a COM object.
(using ATL (with or without using Attributes) )and not using ATL).

I'm lost. Can anybody tell me how to create a C++ module witch i can
use in VB like the Excel example or what words i should search on.
Also, i don't get the ATL Attributes thing. I understand it's supposed
to make a COM object less complicated.

I'm using Visual Studio 2005

Hoping you can help me.
 
N

nicolas.hilaire

unknown; a écrit :
Hi,

i need to write a module in C++ (unmanaged) witch i can use in VB.NET.
The C++ module doesn't have a GUI.
In VB i need to create an instace of the C++ class. I understand the
only way to do this is to make a COM object from my C++ class.

So i searched on the internet and i found so much different stuff about
Active X, COM, OLE, Automation, ATL that i just don't know where to
start to solve my problem.

for example.. if i create a VB project i can add a COM reference (right
click on project -> add refference) and use it in my code like:
Dim Excel As Excel.Application
Excel = New Excel.Application
this is what i want. how do i create such a COM object in C++

all i can find is that i need to use CoCreateInstance to get a pointer
to my CoClass from the COM object
and about QueryInterface, release and the IUnknown interface but when i
create an instance of my the Excel application COM object i don't.. i
don't understand

I understand that there are more than one ways to create a COM object.
(using ATL (with or without using Attributes) )and not using ATL).

I'm lost. Can anybody tell me how to create a C++ module witch i can
use in VB like the Excel example or what words i should search on.
Also, i don't get the ATL Attributes thing. I understand it's supposed
to make a COM object less complicated.

I'm using Visual Studio 2005

Hoping you can help me.

You can make an MFC ActiveX project, then you can use it in VB.Net or
anything else that can use ActiveX.
But why not creating a C++/CLI userControl ?
 
U

unknown;

nicolas, thank you for your reply,

i've never heard of a C++/CLI userControl but when i search the web i
get the feeling it is managed (.NET) stuff.

(e-mail address removed) schreef:
 
N

nicolas.hilaire

you're right, this the .Net version of the activex.

anyway, i think that using MFC to create an activeX is the simpliest
way to make an ActiveX


unknown; a écrit :
 

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

Top