Author |
Topic  |
|
Matthew T

USA
21 Posts |
Posted - May 31 2012 : 14:08:01
|
Hi,
I have an TImageEnView and wanted to save the SelectedAquireSource to the registry so the user does not have to select it each time (there might be more than one network scanner on their network. I also wanted to display the currently selected scanner.
1) I am getting an Access Violation when trying to display the currently selected device:
if ImageEnView.IO.SelectedAcquireSource.Api = ieaNone then LSelectedSource.Caption := 'No device selected' else LSelectedSource.Caption := ImageEnView.IO.SelectedAcquireSource.Name;
The error occurs on the if statement.
2) I have a setup program which I have another ImageEnView control. From there I populate a combobox from the twain and wia params:
AcquireApis := [ieaTwain, ieaWIA]; for i := 0 to ImageEnView.IO.TwainParams.SourceCount - 1 do cxCBScanners.Properties.Items.Add(ImageEnView.IO.TwainParams.SourceName[i]); for i := 0 to ImageEnView.IO.WIAParams.DevicesInfoCount -1 do cxCBScanners.Properties.Items.Add(ImageEnView.IO.WIAParams.DevicesInfo[i].Name);
After the user selects the scanner, I save the name to the registry.
When the user goes to the scan program, I want to set the ImageEnView to use the scanner selected in the setup.
if Scanner <> '' then begin ADevice := StrToAcquireSource(scanner); // this causes an exception: Invalid Raw Str ImageEnView.IO.AcquireParams.SetSource(aDevice.Api, aDevice.Location) end
This bombs out. Any suggestions?
Thanks,
Matthew |
|
xequte
    
39106 Posts |
Posted - Jun 04 2012 : 17:02:57
|
Hi Matthew
1. This will be fixed in the next update
2. TwainParams.SourceName and ImageEnView.IO.WIAParams.DevicesInfo[i].Name list only the names of the devices which cannot be passed to set source.
You should use:
ImageEnView.IO.AcquireParams.FillListWithSources(cxCBScanners.Properties.Items, [ieaTwain, ieaWIA], False);
To fill your combo, then that string can be passed back using
ImageEnView.IO.AcquireParams.SetSourceByStr(sRawDeviceStr);
Note that this will give you an ugly display string so you should custom draw the combobox. This can be done quite easily if you see the AllAcquire.dpr demo at:
http://www.imageen.com/demos/index.html#ImageAcquisition
Nigel Xequte Software www.xequte.com nigel@xequte.com
|
 |
|
|
Topic  |
|
|
|