views:

151

answers:

2

We have a piece of legacy code in C# .NET, targetted for the Compact Framework. We would like to turn this code into an ActiveX control, which has to run on the .NET Compact Framework under Windows Mobile 5. Is it possible to implement such a control? If so, can anyone provice a good resource that explains how this can be done?

I have already searched a lot, but have not yet found a definitive answer or resource.

It would seem that this is perfectely doable on the full .NET Framework. I have also found that it is not possible to launch such a control from an unmanaged context. But otherwise, I cannot find the exact answer to my question.

+1  A: 

The .NET CF does not support hosting. This means it is not possible for an unmanaged process (which most ActiveX containers such as Internet Explorer Mobile etc will be) to spin up a .NET CLR runtime when it requests your control be instantiated via the details specified within the registry. As such the .NET CF doesn't support the features the desktop version has for registering COM/ActiveX objects.

So in that respect it is not possible for you to create an ActiveX control usable by arbitary applications.

If your legacy code is C# based, what is the driving factor behind packaging it as an ActiveX control? Would a managed user control or class library be a suitable replacement?

Christopher Fairbairn
The driving factor is this: another party is implementing a managed application. Our code can handle a very specific piece of functionality that they want to use. Their architecure, for some reason, specifies that they can communicate with external libraries through a strictly defined ActiveX interface. That is the reason that I am investigating this. If it turns out to be impossible, we'll have to find some alternatives...
Daan
Not really the answer I was hoping for, but thanks for your reply. We'll have to figure out an alternative way to interface our code.
Daan
+1  A: 

In short no, since the .NET CF on Windows mobile is very limited and a much smaller subset.. There is no such thing as hosting ActiveX on Windows Mobile due to constraints, hang on...I just realized I wrote a detailed answer to another SO user here.

Hope this helps, Best regards, Tom.

tommieb75
I was afraid this was going to be the answer... Thanks for your reply anyway.
Daan