ImageEn, unit imageenio

TImageEnIO.SetAcquireSource

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


Examples

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

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

// Select the second WIA device
ImageEnView1.IO.SetAcquireSource(ieaWIA, 1);

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

// Read and restore a source
var
  sDevice : string;
  ADevice : TIEAcquireSource;
begin
  ...
  // Read the selected device
  sDevice := AcquireSourceToStr(ImageEnView1.IO.SelectedAcquireSource);
  ...
end;

var
  sDevice : string;
  ADevice : TIEAcquireSource;
begin
  ...
  // Restore the device selection
  ADevice := StrToAcquireSource(sDevice);
  ImageEnView1.IO.SetAcquireSource(ADevice.Api, ADevice.Location);
  ...
end;


See Also

Acquire
SelectedAcquireSource