Author |
Topic  |
|
jrpcguru
  
USA
273 Posts |
Posted - Apr 24 2013 : 16:08:24
|
I must be missing something obvious. How do you refresh the list of scanners so that a user doesn't have to close the program and run it again after turning on their scanner or plugging in an additional scanner?
I've tried: ImageEnView1.IO.AcquireParams.FillListWithSources(cboScannerList.Items, [ieaTwain, ieaWIA, ieaDCIM], False);
and for i := 0 to ImageEnView1.IO.TwainParams.SourceCount - 1 do begin sName := ImageEnView1.IO.TwainParams.SourceName[i];
Neither recognizes a newly available scanner.
J.R. |
|
fab
   
1310 Posts |
Posted - Apr 28 2013 : 08:25:11
|
You should call SetDefaultParams to force reloading of available devices:
ImageEnView1.IO.TwainParams.SetDefaultParams(); for i := 0 to ImageEnView1.IO.TwainParams.SourceCount - 1 do.... |
 |
|
jrpcguru
  
USA
273 Posts |
Posted - May 12 2013 : 12:36:20
|
Thank you. That worked. Suggestion: update the help topic to make it more clear that SetDefaultParams has this use.
J.R. |
 |
|
PeaShooter_OMO

11 Posts |
Posted - Aug 25 2013 : 00:39:06
|
Hello
I am using ImageEn 3.1.2 and SetDefaultParams only works if you switch the scanner on but if you switch the scanner off then that scanner stays in the list even after you have called SetDefaultParams. |
 |
|
fab
   
1310 Posts |
Posted - Sep 07 2013 : 01:12:17
|
Hello, some (almost all, as far as I know) scanner drivers are always present in the list, unless you uninstall the device driver. This list doesn't care that the device is on or off. This is out of ImageEn control. |
 |
|
PeaShooter_OMO

11 Posts |
Posted - Sep 07 2013 : 09:51:16
|
Out of ImageEnView it is not the case. |
 |
|
w2m
   
USA
1990 Posts |
Posted - Sep 07 2013 : 11:45:35
|
What Fabrizio means is, the list is produced by the device driver, not by ImageEn, so he can not control how this works or improve it. You could try to contact the makers of the device.
I have a HP multifunction printer/scanner device connected by WIFI and I too can not determine when the device is on or off. If you could tell if the scanner was off you could just clear the list, but unfortunately HP has decided not to include this as part of the device driver.
I have scoured the internet for some Delphi code to determine if a device is on or off, but not very much is posted about this, so I assume it is just not possible for most devices.
William Miller Adirondack Software & Graphics Email: w2m@frontiernet.net EBook: http://www.imageen.com/ebook/ Apprehend: http://www.frontiernet.net/~w2m/index.html |
 |
|
PeaShooter_OMO

11 Posts |
Posted - Sep 08 2013 : 01:04:23
|
@w2m
I do not agree that this list cannot be populated correctly in ImageEnView.
Simulate the following;
1. Switch off the scanner. 2. Start an instance of a small blank app with one ImageENView component. 3. Read the TwainParams Sources. The scanner most probably will not be in the list. That is what happens here by me. 4. Close the app instance. 5. Switch on the scanner. 6. Start the app agaian. 7. Read the TwainParams Sources again. The scanner will be in the list. 8. Close the app again. 9. Switch off the scanner again. 10. Start the app and read the sources. The scanner is gone from the list.
In other words it seems that the list is not kept between terminated instances of ImageEnView and as such I would consider that it can be reread by ImageEnView without having to recreate the ImageEnView instance which is what you have to do if you want to get a properly updated list between scanner startup/shutdowns |
 |
|
w2m
   
USA
1990 Posts |
Posted - Sep 08 2013 : 05:39:40
|
If my scanner is off or for that matter if all my devices are off, all of the devices are still in the list, so I can not explain why yours acts differently.
William Miller |
 |
|
PeaShooter_OMO

11 Posts |
Posted - Sep 08 2013 : 10:51:56
|
What OS version are you running on? Which version of ImageEn? Is this with the ImageEnView component? Is it also with the TwainParams' Sources list? Do you mind sharing which devices you have connected? Are they all USB? Did you try to simulate what I suggested? |
 |
|
w2m
   
USA
1990 Posts |
Posted - Sep 08 2013 : 12:48:27
|
OS: Windows 8 ImageEn: 4.3 Yes - ImageEnView {Fill sources combobox} ImageEnView.IO.AcquireParams.FillListWithSources(Sources1.Items); Devices: Nikon P520 Camera and HP multifunction printer. Yes... It does not matter if the devices are on or even connected...
William Miller |
 |
|
PeaShooter_OMO

11 Posts |
Posted - Sep 08 2013 : 22:50:05
|
>> ImageEnView.IO.AcquireParams.FillListWithSources(Sources1.Items) >> Yes... It does not matter if the devices are on or even connected...
I assume that you use AcquireParams in your application(s) and as such I am not sure whether you have used TwainParams in the simulation. If not, I wonder if you would do me a favour and try it with TwainParams.SourceName.
|
 |
|
w2m
   
USA
1990 Posts |
Posted - Sep 09 2013 : 05:59:04
|
With my system on Windows 8 with a HP multifunction printer/scanner connected via WiFi this seems to work:
procedure TForm1.FormActivate(Sender: TObject);
var
i: integer;
iDeviceOnLine: boolean;
begin
// fills Twain sources - this is filled even if the printer is off or not connected.
for i := 0 to ImageEnView1.IO.TwainParams.SourceCount - 1 do
ComboBox1.Items.Add(ImageEnView1.IO.TwainParams.SourceName[i]);
// Select first scanner
if ComboBox1.Items.Count > 0 then
begin
ComboBox1.ItemIndex := 0;
ImageEnView1.IO.TwainParams.SelectedSource := ComboBox1.ItemIndex;
end;
ImageEnView1.IO.TwainParams.AppVersionInfo := '1.0';
ImageEnView1.IO.TwainParams.AppManufacturer := 'HiComponents';
ImageEnView1.IO.TwainParams.AppProductFamily := 'Image processing';
ImageEnView1.IO.TwainParams.AppProductName := 'ImageEn demo';
// When the next line is excuted and the printer is offline a system message box spears advising you that the device is offline.
iDeviceOnLine := ImageEnView1.IO.TwainParams.DeviceOnline;
if not iDeviceOnline then
ShowMessage('Device is not on or is not connected.')
else
ShowMessage('Device is on line.');
if iDeviceOnline then
FillBack;
end; You can test this by making the changes to the ImageAquisition demo.
In my case on Windows 8, when you try to access any TwainParams and the printer is offline a message appears telling you the device is not connected so the ShowMessage message appear after you have already been notified that the scanner is not connected by the printer driver or the OS.
I hope this helps.
Regards,
Bill
William Miller |
 |
|
|
Topic  |
|