简体   繁体   English

是否可以在C#.NET CF中为Windows Mobile编写ActiveX控件?

[英]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. 我们在C#.NET中有一段针对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? 我们想将此代码转换为ActiveX控件,该控件必须在Windows Mobile 5下的.NET Compact Framework上运行。是否可以实现这样的控件? 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. 在完整的.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. .NET CF不支持托管。 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. 这意味着,非托管进程(大多数ActiveX容器,如Internet Explorer Mobile等)将无法通过注册表中指定的详细信息实例化控件时启动.NET CLR运行时。 As such the .NET CF doesn't support the features the desktop version has for registering COM/ActiveX objects. 因此,.NET CF不支持桌面版本具有的用于注册COM / ActiveX对象的功能。

So in that respect it is not possible for you to create an ActiveX control usable by arbitary applications. 因此,就此而言,您不可能创建适用于任意应用程序的ActiveX控件。

If your legacy code is C# based, what is the driving factor behind packaging it as an ActiveX control? 如果您的旧代码是基于C#的,将其打包为ActiveX控件的驱动因素是什么? 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 . 简而言之,因为Windows Mobile上的.NET CF非常有限,并且子集很小。.由于限制,没有在Windows Mobile上托管ActiveX之类的东西,请稍等...我只是意识到我写了详细的答案另一SO用户在这里

Hope this helps, Best regards, Tom. 希望这对您有所帮助,汤姆,谢谢。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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