In This Topic
TWAIN device manager allows to show a standard device selection dialog. Standard device selection dialog allows to view a device list and select the default device. Standard device selection dialog can be shown using the DeviceManager_ShowDefaultDeviceSelectionDialog method.
Here is an example that shows to how show a standard TWAIN device selection dialog:
Private VSTwain1 As New VintaSoftTwain()
''' <summary>
''' Shows standard TWAIN device selection dialog.
''' </summary>
Public Sub ShowDeviceSelectionDialog()
' open device manager
VSTwain1.DeviceManager_Open()
' show standard TWAIN device selection dialog
VSTwain1.DeviceManager_ShowDefaultDeviceSelectionDialog()
End Sub
Moreover TWAIN device manager allows to get device list programmatically. Device list can be get using the DeviceManager_DeviceCount property and Device_Info_GetProductName method. Index of default device can be get using the DeviceManager_DefaultDeviceIndex property. Information about selected device can be get using the DeviceManager_SelectedDeviceIndex property.
Here is an example that shows how get information about all devices installed in the system:
Private VSTwain2 As New VintaSoftTwain()
''' <summary>
''' Gets information about all devices installed in the system.
''' </summary>
Public Sub GetDevicesInfo()
' open device manager
VSTwain2.DeviceManager_Open()
' for each device
For i As Integer = 0 To VSTwain2.DeviceManager_DeviceCount - 1
' output the device name
Console.WriteLine(String.Format("Device '{0}'", VSTwain2.Device_Info_GetProductName(i)))
Next
End Sub
FAQ: I cannot see devices in the TWAIN selection dialog of my application but I can see them in other applications. Why?
Most probably you use your application in 64-bit system and your application is compiled as 64-bit application, in this case you need native 64-bit TWAIN driver for your device.
You can compile your application in "Any CPU" mode and in this case:
- your application will work as 32-bit application on 32-bit systems,
your application will be able to work with 32-bit version of TWAIN Device Manager 1.x and 2.x,
your application will be able to work with any 32-bit TWAIN or WIA driver
- your application will work as 64-bit application on 64-bit systems,
your application will be able to work with 64-bit version of TWAIN Device Manager 2.x,
your application will be able to work with any 64-bit TWAIN driver
You can compile your application in "x86" mode and in this case:
- your application will work as 32-bit application on 32-bit systems,
your application will be able to work with 32-bit version of TWAIN Device Manager 1.x and 2.x,
your application will be able to work with any 32-bit TWAIN or WIA driver
- your application will work as 32-bit application on 64-bit systems,
your application will be able to work with 32-bit version of TWAIN Device Manager 1.x and 2.x,
your application will be able to work with any 32-bit TWAIN or WIA driver
You can compile your application in "x64" mode and in this case:
- your application will NOT work on 32-bit systems
- your application will work as 64-bit application on 64-bit systems,
your application will be able to work with 64-bit version of TWAIN Device Manager 2.x,
your application will be able to work with any 64-bit TWAIN driver
We
recommend to use "x86" compilation mode because all scanners have 32-bit TWAIN drivers but only new and professional scanners have native 64-bit TWAIN drivers.