Solved

Can you make a activeX component in .net?

Posted on 2003-11-25
8
234 Views
Last Modified: 2009-07-29
I know its possible to make a .net component, but to knownledge they can only be used it .net compatiable languages. I need a component to work in C++.


Kind Regards

Tom
0
Comment
Question by:tomcoombs
  • 4
8 Comments
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 9817353
" know its possible to make a .net component, but to knownledge they can only be used it .net compatiable languages."   this is NOT quite correct.  It is possible for a VS.NET to create a .NET DLL, with an ActiveX wrapper, so it LOOKS like an ActiveX DLL.  But is you are talking about build a CONTROL, in .NET, that can be used in C++, then you are correct.  

0
 
LVL 44

Accepted Solution

by:
Arthur_Wood earned 125 total points
ID: 9817370
lookup "Com Wrappers" in the .NET Help system.

to wit:

"COM differs from the .NET Framework object model in several important ways:

Clients of COM objects must manage the lifetime of those objects; the common language runtime manages the lifetime of objects in its environment.
Clients of COM objects discover whether a service is available by requesting an interface that provides that service and getting back an interface pointer, or not. Clients of .NET objects can obtain a description of an object's functionality using reflection.
NET objects reside in memory managed by the .NET Framework execution environment. The execution environment can move objects around in memory for performance reasons and update all references to the objects it moves. Unmanaged clients, having obtained a pointer to an object, rely on the object to remain at the same location. These clients have no mechanism for dealing with an object whose location is not fixed.
To overcome these differences, the runtime provides wrapper classes to make both managed and unmanaged clients think they are calling objects within their respective environment. Whenever your managed client calls a method on a COM object, the runtime creates a runtime callable wrapper (RCW). RCWs abstract the differences between managed and unmanaged reference mechanisms, among other things. The runtime also creates a COM callable wrapper (CCW) to reverse the process, enabling a COM client to seamlessly call a method on a .NET object. As the following illustration shows, the perspective of the calling code determines which wrapper class the runtime creates."



AW
0
 

Author Comment

by:tomcoombs
ID: 9817467
Good info, and I can select the "make COM wrapper" option in the project setings to do that. But how do I register it as an ActiveX component to say, view it in the activeX test container.

I understand activeX control implement certain interfaces (IOleControl etc).


Thanks

Tom
0
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 9818698
using RegAsm - you are actually Registering the Assembly.

AW
0
 

Expert Comment

by:tom_coombs
ID: 9823536
Thanks again, this I feel that this is getting closer...

Done that, all worked. (Registered the tlb file)  But I still do not have a registered activeX control when looking in the test container.

Back to your prev point, which could prove that this task is simpley not possible (in which .net has taken a step backwards!!) :

"It is possible for a VS.NET to create a .NET DLL, with an ActiveX wrapper, so it LOOKS like an ActiveX DLL.  But is you are talking about build a CONTROL, in .NET, that can be used in C++, then you are correct. " -  I thought activeX was a universally sharable CONTROL built using COM techniques, or am I wrong?

Any other ideas? Have you actually ever managed to create a .net usercontrol dll and somehow run it in the activeX container?



Regards

Tom
0
 
LVL 44

Expert Comment

by:Arthur_Wood
ID: 9824059
as I stated, it is NOT possible to create a .NET UserControl that is accesible from COM.  ActiveX DLLs are 'universally accessible', but .NET is not capable of creating a CONTROL that has a COM-WRAPPER. Sorry about that.

AW
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question