KenF
KenF

Reputation: 41

PocketPC Camera control question

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?

Upvotes: 4

Views: 522

Answers (1)

MusiGenesis
MusiGenesis

Reputation: 75296

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).

Upvotes: 2

Related Questions