A WIA scan from a flatbed using the TImageEnMView will fail when the MIO.AcquireParams.VisibleDialog is set to false.
iexAcquire.pas contains the following source:
// Allow flatbed scanning via TImageEnMIO
if fWIAVisibleDialog and bMultiple then
bMultiple := WIADevicePropertyHasFlag(WIA_DPS_DOCUMENT_HANDLING_SELECT, WIA_FEEDER);
Because of the fWIAVisiableDialog flag, scans from flatbed scanners fail when the VisibleDialog is not set (as in this case bMultiple may be true even though the flatbed does not support this).
After removing this flag I was able to start a scan using a flatbed without first having to select a scanner using a dialog.
A second issue I ran into was an AV in iewia.pas when setting the "Handled" flag to True in the OnAcquireBitmap event.
iewia contains the following source:
if assigned(fMultiCallBack) then
begin
fMultiCallBack(ProcessingBitmap, TObject(callbackParams), tmpparams.DpiX, tmpparams.DpiY);
AssignIO(callbackParams, tmpparams);
end;
If the handled flag in the fMultiCallBack is set to true the "callbackParams" will be NIL, which results in an AV in the AssignIO().
After modifying the code to
if assigned(fMultiCallBack) then
begin
fMultiCallBack(ProcessingBitmap, TObject(callbackParams), tmpparams.DpiX, tmpparams.DpiY);
if Assigned(callbackParams) then
AssignIO(callbackParams, tmpparams);
end;
I was able to scan.