In This Topic
TWAIN device manager allows to show standard TWAIN device selection dialog. Standard TWAIN device selection dialog allows to view TWAIN device list and select the default TWAIN device. Standard TWAIN device selection dialog can be shown using the
DeviceManager.ShowDefaultDeviceSelectionDialog method.
Here is an example that demonstrates how to show standard TWAIN device selection dialog:
/// <summary>
/// Shows standard TWAIN device selection dialog.
/// </summary>
void ShowDeviceSelectionDialog()
{
// create device manager
using (Vintasoft.Twain.DeviceManager deviceManager = new Vintasoft.Twain.DeviceManager())
{
// open device manager
deviceManager.Open();
// show standard TWAIN device selection dialog
deviceManager.ShowDefaultDeviceSelectionDialog();
}
}
''' <summary>
''' Shows standard TWAIN device selection dialog.
''' </summary>
Private Sub ShowDeviceSelectionDialog()
' create device manager
Using deviceManager As New Vintasoft.Twain.DeviceManager()
' open device manager
deviceManager.Open()
' show standard TWAIN device selection dialog
deviceManager.ShowDefaultDeviceSelectionDialog()
End Using
End Sub
Moreover TWAIN device manager allows to get TWAIN device list programmatically. TWAIN device list can be get using the
DeviceManager.Devices property. Information about the default TWAIN device can be get using the
DeviceManager.DefaultDevice property. Information about opened TWAIN device can be get using the
DeviceManager.OpenedDevice property.
Here is an example that demonstrates how to get information about all TWAIN devices installed in the system:
/// <summary>
/// Gets information about all devices installed in the system.
/// </summary>
void GetDevicesInfo()
{
// create device manager
using (Vintasoft.Twain.DeviceManager deviceManager = new Vintasoft.Twain.DeviceManager())
{
// open device manager
deviceManager.Open();
Vintasoft.Twain.DeviceCollection devices = deviceManager.Devices;
// for each device
for (int i = 0; i < devices.Count; i++)
{
// output the device name
System.Console.WriteLine(string.Format("Device '{0}'", devices[i].Info.ProductName));
}
}
}
''' <summary>
''' Gets information about all devices installed in the system.
''' </summary>
Private Sub GetDevicesInfo()
' create device manager
Using deviceManager As New Vintasoft.Twain.DeviceManager()
' open device manager
deviceManager.Open()
Dim devices As Vintasoft.Twain.DeviceCollection = deviceManager.Devices
' for each device
For i As Integer = 0 To devices.Count - 1
' output the device name
System.Console.WriteLine(String.Format("Device '{0}'", devices(i).Info.ProductName))
Next
End Using
End Sub