Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 253
  • Last Modified:

Can you make a activeX component in .net?

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
tomcoombs
Asked:
tomcoombs
  • 4
1 Solution
 
Arthur_WoodCommented:
" 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
 
Arthur_WoodCommented:
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
 
tomcoombsAuthor Commented:
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
Independent Software Vendors: 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!

 
Arthur_WoodCommented:
using RegAsm - you are actually Registering the Assembly.

AW
0
 
tom_coombsCommented:
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
 
Arthur_WoodCommented:
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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now