Hey there,
we're using a licensed version of VintaSoftTwain.NET 8.3.6.1 and have problems with the list of scanners the DeviceManager provides.
Our application runs on a server and provides a list of connected scanners via DeviceManager.Devices.Count and DeviceManager.Devices.GetDevice(index).Info.ProductName.
If a scanner is getting disconnected while the server runs, the methods of the DeviceManager show the disconnected scanner nevertheless. You have to restart the whole program to refresh this devicelist.
Is it possible to refresh the devicelist of the DeviceManager to show if the scanner is connected?
Thank you in advance
Felix
List of connected scanners
Moderator: Alex
-
- Site Admin
- Posts: 2397
- Joined: Thu Jul 10, 2008 2:21 pm
Re: List of connected scanners
Hello Felix,
You can close the device manager and open it again - this actions will refresh the devices list.
Best regards, Alexander
You can close the device manager and open it again - this actions will refresh the devices list.
Best regards, Alexander
-
- Posts: 2
- Joined: Wed Sep 17, 2014 11:10 am
Re: List of connected scanners
Hi Alex,
thanks for your answer. I tried closing and re-opening the device manager.
If I connect an additional scanner it is added to the list, but if I disconnect one it is shown although it isn't plugged in any longer after closing and opening the device manager.
Best regards
Felix
thanks for your answer. I tried closing and re-opening the device manager.
If I connect an additional scanner it is added to the list, but if I disconnect one it is shown although it isn't plugged in any longer after closing and opening the device manager.
Best regards
Felix
-
- Site Admin
- Posts: 2397
- Joined: Thu Jul 10, 2008 2:21 pm
Re: List of connected scanners
Hi Felix,
Thank you for information. We have reproduced the problem and will try to fix it in shortest time.
Best regards, Alexander
Thank you for information. We have reproduced the problem and will try to fix it in shortest time.
Best regards, Alexander
-
- Site Admin
- Posts: 2397
- Joined: Thu Jul 10, 2008 2:21 pm
Re: List of connected scanners
Hello Felix,
In version 9.0.3.1 we have improved the algorithm that loads TWAIN device manager and now you can get refreshed device list as follows:
Best regards, Alexander
In version 9.0.3.1 we have improved the algorithm that loads TWAIN device manager and now you can get refreshed device list as follows:
Code: Select all
int oldDeviceCount = 0;
int newDeviceCount = 0;
// create the device manager
using (DeviceManager deviceManager = new DeviceManager())
{
// open the device manager
deviceManager.Open();
// get device count
oldDeviceCount = deviceManager.Devices.Count;
// close the device manager
deviceManager.Close();
}
Console.WriteLine("Please detach one or several USB TWAIN devices.");
Console.WriteLine("Press any key when done.");
Console.ReadKey();
// create new device manager
using (DeviceManager deviceManager = new DeviceManager())
{
// open the device manager
deviceManager.Open();
// get device count
newDeviceCount = deviceManager.Devices.Count;
// close the device manager
deviceManager.Close();
}
if (oldDeviceCount <= newDeviceCount)
throw new ApplicationException("Device list is not refreshed.");