471,123 Members | 914 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,123 software developers and data experts.

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

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.

Oct 10 '06 #1
3 1482

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 ?

Oct 10 '06 #2
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.

ni*************@motorola.com schreef:
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 ?
Oct 10 '06 #3
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 :
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.

ni*************@motorola.com schreef:
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 wheni
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 ?
Oct 10 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

8 posts views Thread by AnalogKid | last post: by
1 post views Thread by wang xiaoyu | last post: by
2 posts views Thread by Fie Fie Niles | last post: by
6 posts views Thread by Pippen | last post: by
12 posts views Thread by A.M. | last post: by
18 posts views Thread by DartmanX | last post: by
7 posts views Thread by Jarod_24 | last post: by
4 posts views Thread by Wilfried Mestdagh | last post: by
6 posts views Thread by hufaunder | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.