Can you make a activeX component in .net?

Posted on 2003-11-25
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

Question by:tomcoombs
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
LVL 44

Expert Comment

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.  

LVL 44

Accepted Solution

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."


Author Comment

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).



Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

LVL 44

Expert Comment

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


Expert Comment

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?


LVL 44

Expert Comment

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.


Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

630 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