Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Can you make a activeX component in .net?

Posted on 2003-11-25
Medium Priority
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 375 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).


Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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

Enroll in September's Course of the Month

This month’s featured course covers 16 hours of training in installation, management, and deployment of VMware vSphere virtualization environments. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
Summary: Persistence is the capability of an application to store the state of objects and recover it when necessary. This article compares the two common types of serialization in aspects of data access, readability, and runtime cost. A ready-to…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

705 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