Reputation: 21
I have created a solution for a handheld scanner that targets Windows Mobile 6.1. Now I need to know if it's possible to embed this solution into an ActiveX to run on IE8 (not mobile). This is a backup in case the handheld is not available. Obviously the scanning capabilities won't work but other than that, is it possible to convert it? I don't want to have to manage multiple copies of the same code.
Upvotes: 2
Views: 203
Reputation: 1977
This would seem to suggest that it is possible at some level:
http://www.dreamincode.net/forums/topic/38890-activex-with-c%23/
However, myself and another developer tried to get this working on a mobile browser for a number of weeks without success. I don't know if it is the project type itself or a limitation of the device but it just didn't want to play.
As ctacke suggested, I'd give this idea a very wide berth. ActiveX is old technology and limits you to IE. I'd strongly suggest doing this another way if you can.
Upvotes: 2
Reputation: 67168
No, you can't. The Compact Framework does not support EE Hosting, so there's no way to compile anything for the Compact Framework directly to a COM/ActiveX object.
Could you create a desktop C# project and then pull in the code files and compile that to an ActiveX control? It depends on how much work you want to do. At a bare minimum, you'd have to define COM interfaces for all exposed classes as well as add attributes to the classes like Guid, InterfaceType and ComVisible as well as Didpid to each of the properties. You'll have to make sure all exposed types a COM-capable and also interfaced. Trying to keep that codebase still compilable as your existing CF app would be a large challenge by itself.
Of course you then would have problems with any P/Invokes (and it's a pretty rare CF app that didn't need them). You'd have to abstract those in yet another interface (or more). And any Window handling at the UI level is likely going to need changing.
By the time you get all of that working, you will probably would have spent more time that just completely rewriting the app for the browser and it probably won't work as well as a rewrite would have.
Upvotes: 2