ImageEn, unit iexAcquire

StrToAcquireSource


Declaration

function StrToAcquireSource(const sRawDeviceStr : string) : TIEAcquireSource;


Description

If you use FillListWithSources from your own code then the returned devices will be list of strings formatted as follows:

Device Name||Index of Location||API||Device Type

E.g. My Cool Scanner||3||TWN||SCN

You can use StrToAcquireSource to convert the raw string to a TIEAcquireSource record.


Example

// Save the current acquisition source to the registry
procedure TMainForm.FormClose(Sender: TObject; var Action: TCloseAction);
var
  sDevice : string;
begin
  ...
  // Read the selected device
  sDevice := AcquireSourceToStr( ImageEnMView1.MIO.SelectedAcquireSource );
  WRegistry.WriteString( 'SelectedAcquireSource', sDevice );
  ...
end;

// Read the current acquisition source to the registry
procedure TMainForm.FormShow(Sender: TObject);
var
  sDevice : string;
  ADevice : TIEAcquireSource;
begin
  ...
  // Restore the device selection
  sDevice := WRegistry.ReadString( 'SelectedAcquireSource', '' );
  if sDevice <> '' then
  begin
    ADevice := StrToAcquireSource( sDevice );
    ImageEnView1.IO.SetAcquireSource( ADevice.Api, ADevice.Location );
    Label1.Caption := 'Scanner: ' + ADevice.Name;
  end;
  ...
end;


See Also

- AcquireSourceToStr