Accessing a digital camera through a dialog box in .NET

A client has asked us to write a little Windows Forms app that will take the pictures on a digital camera and transfer them to a folder on the hard drive.  No sweat, we thought – it’s very easy to transfer files and folders using the System.IO namespace – files on devices will surely function similarly.

But we searched and searched and Googled and Googled, and came up empty.  Finally we found this blog entry, which is apparently the definitive authority about using an old COM component called Windows Image Acquisition (WIA) to work with cameras and scanners:

(Important Note:  if you don’t have a device connected when you try to run the code that opens the dialog box, you will get an error that looks like this:

Exception from HRESULT: 0x80210015
Source: Interop.WIA
at WIA.CommonDialogClass.ShowSelectDevice(...) )

In the course of trying to work with WIA, we also found an MSDN entry (which has a lot of info but code samples are in C++) and a couple more posts with additional information:

Perhaps there is a more modern, .NET managed code way to do this, but until I find it, I thought I’d better have these links handy!!