How to select TWAIN device without displaying the TWAIN device selection dialog?
In This Topic
Here is an example that demonstrates how to select TWAIN device by name:
/// <summary>
/// Select the device by the device name.
/// </summary>
public void SelectDeviceByName(Vintasoft.Twain.DeviceManager deviceManager, string deviceName)
{
// open TWAIN device manager
deviceManager.Open();
// select the device by device name
Vintasoft.Twain.Device device = deviceManager.Devices.Find(deviceName);
// if device is not found
if (device == null)
// throw exception
throw new System.Exception("Device is not found.");
// acquire images asynchronously
device.Acquire();
}
''' <summary>
''' Select the device by the device name.
''' </summary>
Public Sub SelectDeviceByName(deviceManager As Vintasoft.Twain.DeviceManager, deviceName As String)
' open TWAIN device manager
deviceManager.Open()
' select the device by device name
Dim device As Vintasoft.Twain.Device = deviceManager.Devices.Find(deviceName)
' if device is not found
If device Is Nothing Then
' throw exception
Throw New System.Exception("Device is not found.")
End If
' acquire images asynchronously
device.Acquire()
End Sub