支持 WindowsMobile5(及更高版本)设备同时保持与用 C# 编写的 PocketPC 2003 的代码兼容性的最佳方法是什么?我们有一个相当大的应用程序,由一群不同的客户使用,在拥有实际 PPC2003 设备的人和其他较新的 WinMobile5 或更新的设备之间大致平均分配 - 即,我们必须在相当长的一段时间内继续支持旧设备然而。现在,我需要向应用程序添加相机控制,至少对于那些具有相机的设备来说是这样,这样他们就可以拍摄照片并将其附加到其他数据,这些数据最终会发送到网络服务进行处理。
到目前为止,我的研究已经在 Microsoft.WindowsMobile.Forms dll 中发现了 CameraCaptureDialog 类,但我无法将该引用添加到 PocketPC 2003 应用程序。老板不太热衷于将应用程序分成单独的 PPC2003 和 WinMobile 项目。有没有办法动态加载该 dll,并以这种方式使用 CameraCaptureDialog?还有其他选择吗?
What's the best way to support WindowsMobile5 (and later) devices while maintaining code compatibility with PocketPC 2003, written in C#? We've got a rather large app in use by a bunch of different customers, roughly split equally between people with actual PPC2003 devices, and the rest newer WinMobile5 or newer -- ie, we have to continue supporting the older devices for quite a while yet. Now, I need to add camera-control to the app, at least for those devices that have a camera, so they can snap a photo and attach it to other data that eventually gets sent up to a webservice for processing.
My research so far has turned up the CameraCaptureDialog class in the Microsoft.WindowsMobile.Forms dll, but I can't add that reference to a PocketPC 2003 application. The boss isn't too keen on splitting the application up into seperate PPC2003 and WinMobile projects. Is there a way to load that dll dynamically, and using CameraCaptureDialog that way? Some other option?
发布评论
评论(1)
从 .NetCF PocketPC 2003 应用程序访问相机的唯一方法是通过 P/调用 C/C++ DLL。 Intertubes 周围有一个示例应用程序(我会寻找它 - 我不记得细节,但我认为 C 代码通过 DirectShow 访问相机),但它使用起来相当复杂,可能不会'不完全按照您的需要去做。从好的方面来说,如果您能弄清楚如何做到这一点,它将适用于 PocketPC 2003 和 Windows Mobile 5(即功能性 PPC2003 应用程序也可以在 WinMo5 设备上运行)。
CameraCaptureDialog 几乎没什么用,所以你不会在那里损失太多。理想情况下,作为程序员,您希望可以通过编程方式控制相机界面(即设置分辨率、从相机切换到视频、拍照等),但除了打开设备的内置接口。
更新:这是我提到的示例应用程序:
链接
我记错了:该示例在 PocketPC 2003 中无法工作(仅在 Windows Mobile 5 及更高版本中)。据我所知,没有办法在 PocketPC 2003 中访问设备摄像头。至少没有独立于设备和/或制造商的访问摄像头的方式。对于某些设备(例如 HP iPaq),制造商通过设备上已有的 DLL(您可以通过 P/Invoke 访问)公开相机功能。
如果您需要集成相机,设备必须运行 Windows Mobile 5(或更高版本)。有些设备可以升级到更新版本的操作系统,但我肯定不得不质疑这一举动。最好迁移到更现代的设备(例如 Droid)。
The only way to access the camera at all from a .NetCF PocketPC 2003 application is by P/Invoking a C/C++ DLL. There's a sample app for this floating around the Intertubes somewhere (I'll look for it - I can't remember the details but I think the C code accesses the camera through DirectShow), but it's fairly complicated to work with and probably won't do exactly what you need. On the plus side, if you can figure out how to do it, it will work for both PocketPC 2003 and Windows Mobile 5 (i.e. the functional PPC2003 app will also run on a WinMo5 device).
The CameraCaptureDialog is nearly useless, so you're not losing much there. Ideally, as a programmer you'd want the camera interface to be controllable programmatically (i.e. set the resolution, switch from camera to video, take the picture etc.), but it really doesn't let you do anything other than open the device's built-in interface.
Update: Here is the sample application I mentioned:
Link
And I misremembered: this sample will not work in PocketPC 2003 (only in Windows Mobile 5 and up). There is no way that I know of to access the device camera in PocketPC 2003. At least there is no device- and/or manufacturer-independent way of accessing the camera. With some devices (the HP iPaq, for example) the manufacturer exposes camera functionality through a DLL already present on the device (which you can access via P/Invoke).
If you need camera integration, the device has to be running Windows Mobile 5 (or newer). Some devices can be upgraded to a newer version of the OS, but I'd definitely have to question that move. Better to move to a more modern device (like the Droid, for example).