Как выбрать TWAIN-устройство без отображения диалогового окна выбора TWAIN-устройства?
В этом разделе
Вот пример, который демонстрирует, как выбрать устройство по имени:
/// <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(ByVal deviceManager As Vintasoft.Twain.DeviceManager, ByVal 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 Exception("Device is not found.")
End If
' acquire images asynchronously
device.Acquire()
End Sub