VintaSoft Twain .NET SDK 15.4: Documentation for .NET developer
Vintasoft.Twain Namespace / DeviceManager Class
Members Object Syntax Remarks Example Hierarchy Requirements SeeAlso
In This Topic
DeviceManager Class
In This Topic
Allows to manage TWAIN devices.
Object Model
DeviceCollection Device Device DeviceManager
Syntax
'Declaration

Public NotInheritable Class DeviceManager

public sealed class DeviceManager

Remarks

Class allows to:

  • determine that TWAIN device manager is installed in the system
  • choose which TWAIN device manager to use (1.x or 2.x)
  • specify path to the TWAIN device manager
  • get a list of TWAIN devices, which are installed in the system
  • select TWAIN device

Example

This C#/VB.NET code shows how to select TWAIN device and acquire images from TWAIN device.


''' <summary>
''' Starts the asynchronous image acquisition from scanner.
''' </summary>
Private Sub StartScan(deviceManager As Vintasoft.Twain.DeviceManager)
    ' specify TWAIN name of this application
    deviceManager.ApplicationProductName = "MyTwainApplication"
    Try
        ' open the device manager
        deviceManager.Open()

        ' show the default device selection dialog
        If Not deviceManager.ShowDefaultDeviceSelectionDialog() Then
            ' exit if default device is not selected
            Return
        End If

        ' get reference to the default device
        Dim device As Vintasoft.Twain.Device = deviceManager.DefaultDevice
        ' acquire image(s) from the device
        device.Acquire()
    Catch ex As Vintasoft.Twain.TwainException
        System.Console.WriteLine(ex.Message)
    End Try
End Sub


/// <summary>
/// Starts the asynchronous image acquisition from scanner.
/// </summary>
void StartScan(Vintasoft.Twain.DeviceManager deviceManager)
{
    // specify TWAIN name of this application
    deviceManager.ApplicationProductName = "MyTwainApplication";
    try
    {
        // open the device manager
        deviceManager.Open();

        // show the default device selection dialog
        if (!deviceManager.ShowDefaultDeviceSelectionDialog())
            // exit if default device is not selected
            return;

        // get reference to the default device
        Vintasoft.Twain.Device device = deviceManager.DefaultDevice;
        // acquire image(s) from the device
        device.Acquire();
    }
    catch (Vintasoft.Twain.TwainException ex)
    {
        System.Console.WriteLine(ex.Message);
    }
}

Inheritance Hierarchy

System.Object
   Vintasoft.Twain.DeviceManager

Requirements

Target Platforms: .NET 10; .NET 9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

See Also