简体   繁体   中英

Is it possible to write an ActiveX control in C# .NET CF for windows mobile?

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.

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM