ImageEn, unit iemio

TImageEnMIO.SetAcquireSource

TImageEnMIO.SetAcquireSource


Declaration

function SetAcquireSource(Api : TIEAcquireApi; Location : Variant) : boolean;


Description

Set the selected acquisition source by an API type and device. The selected device will be used for subsequent calls to Acquire.
Result is false if the device cannot be selected (i.e. is not connected or does not exist).

The API can be one of the following:
Value Description
ieaTwain Acquire from Twain device
ieaWIA Acquire using WIA (scanners or camera)
ieaDCIM Read from a connected phone, camera or device (containing a DCIM folder) using the WPD API

Location can be one of the following:
Value Description
Default_Device The default device for that API type will be selected
Index An index of a device, e.g. 0 for the first device (ieaTwain/ieaWIA/ieaDCIM)
Name The name of a device, e.g. 'CanoScan FB620' (ieaTwain/ieaWIA/ieaDCIM)
Path The path of a DCIM folder, e.g. 'I:\DCIM\' (ieaDCIM)
Drive Letter The letter of a connected camera card or device containing a DCIM folder, e.g. 'I' (ieaDCIM)


See Also

Acquire
SelectedAcquireSource


Examples

// Acquire from the default Twain device
if ImageEnMView1.MIO.SetAcquireSource(ieaTwain, Default_Device) then
  ImageEnMView1.MIO.Acquire();

// Select a Twain scanner by name
ImageEnMView1.MIO.SetAcquireSource(ieaTwain, 'CanoScan FB620');

// Select the second WIA device     
ImageEnMView1.MIO.SetAcquireSource(ieaWIA, 1);

// Acquire from the camera card on H drive
if ImageEnMView1.MIO.SetAcquireSource(ieaDCIM, 'H') then
  ImageEnMView1.MIO.Acquire();

// Read and restore a source
var
  sDevice : string;
  ADevice : TIEAcquireSource;
begin
  ..
  // Read the selected device
  sDevice := AcquireSourceToStr(ImageEnMView1.MIO.SelectedAcquireSource);
  ..
end;
    
var
  sDevice : string;
  ADevice : TIEAcquireSource;
begin
  ..
  // Restore the device selection
  ADevice := StrToAcquireSource(sDevice);
  ImageEnMView1.MIO.SetAcquireSource(ADevice.Api, ADevice.Location);
  ..
end;