I'm working with WIA 2.0 with Delphi XE2. Right now, I'm attempting to get a scanner to scan. At first I was using CommonDialog.ShowAcquireImage which was working fine, except for one thing. I would like to be able to pass in an IDevice, an IDeviceInfo, or the DeviceId in order to skip the device selection dialog. I've tried enumerating through the Commands property of the IDevice, but all I get is Synchonize and Build Device Tree. Neither of those two commands seems to be what I'm looking for.
I'm trying to avoid this dialog box

But still show this dialog box
.
I've been able to get close two ways. The first is to just use the ShowTransfer method of ICommonDialog
procedure TForm1.btnAutoScanClick(Sender: TObject);
var
lDevice : IDevice;
lImage : IImageFile;
lCommonDialog : ICommonDialog;
begin
lDevice := fDeviceManager.DeviceInfos[1].Connect;
lCommonDialog := CoCommonDialog.Create;
lCommonDialog.ShowDeviceProperties(lDevice,false);
lImage := IUnknown(lCommonDialog.ShowTransfer(lDevice.Items[1],'{B96B3CAE-0728-11D3-9D7B-0000F81EF32E}',false)) as IImageFile;
lImage.SaveFile('c:\testauto.jpg');
end;
This causes both dialogs to be skipped over and a progress bar to be shown. This won't work as is because I still need to show the properties dialog box.
The second way I've gotten close is to call ShowAcquireImage on an ICommonDialog
procedure TForm1.btnScanClick(Sender: TObject);
const
pngFormat = '{B96B3CAF-0728-11D3-9D7B-0000F81EF32E}';
jpegFormat = '{B96B3CAE-0728-11D3-9D7B-0000F81EF32E}';
var
lImage : IImageFile;
lDialog : ICommonDialog;
begin
lDialog := CoCommonDialog.Create;
lImage := lDialog.ShowAcquireImage(WIA_TLB.UnspecifiedDeviceType,WIA_TLB.GrayscaleIntent,WIA_TLB.MinimizeSize,
jpegFormat,false,false,false);
lImage.SaveFile('c:\testmanual.jpg');
end;
which works exactly how I want it if there is only one WIA device connected to the computer. The second I plug my camera phone back into the computer I start getting the Select Device dialog box.
My question is how can I skip the device selection dialog box while scanning regardless of how many devices are connected to the machine but still show the properties dialog box?