VintaSoft Twain .NET SDK 12.1
In This Topic
    How to use 32-bit TWAIN driver in 64-bit application?
    In This Topic

    Unfortunately 32-bit TWAIN driver can be accessed only from 32-bit application. For solving this problem the SDK uses 32-bit application VintasoftTwainService.exe as a bridge between 64-bit application and 32-bit TWAIN driver.

    Important: VintasoftTwainService.exe is necessary only if you want to work with 32-bit TWAIN driver from 64-bit application.

    The DeviceManager.VintasoftTwainServiceExePath property allows to get/set path to a directory, where the VintaSoft TWAIN service (VintasoftTwainService.exe) is located. By default VintasoftTwainService.exe must be located in the application directory.
    The DeviceManager.VintasoftTwainServiceDataPath property allows to get/set path to a directory, where data of VintaSoft TWAIN service must be saved. By default the service data are stored in the local temp directory of current user.

    Here is an example that demonstrates how to use 32-bit TWAIN drivers in 64-bit application:

    ' The project, which uses this code, must have references to the following assemblies:
    ' - Vintasoft.Twain
    
    ''' <summary>
    ''' Shows a list of 32-bit TWAIN drivers in 64-bit application.
    ''' </summary>
    ''' <remarks>
    ''' This code must be used in 64-bit application.
    ''' </remarks>
    Private Sub Use32BitTwainDriversIn64BitApplication()
        ' create the device manager
        Using deviceManager As New Vintasoft.Twain.DeviceManager()
            ' specify that TWAIN device manager 2.x must be used
            deviceManager.IsTwain2Compatible = True
            ' specify that 64-bit TWAIN device manager 2.x must use 32-bit devices
            deviceManager.Use32BitDevices()
    
            ' open the device manager
            deviceManager.Open()
    
            ' show a dialog for selecting 32-bit TWAIN driver
            deviceManager.ShowDefaultDeviceSelectionDialog()
        End Using
    End Sub
    
    // The project, which uses this code, must have references to the following assemblies:
    // - Vintasoft.Twain
    
    /// <summary>
    /// Shows a list of 32-bit TWAIN drivers in 64-bit application.
    /// </summary>
    /// <remarks>
    /// This code must be used in 64-bit application.
    /// </remarks>
    void Use32BitTwainDriversIn64BitApplication()
    {
        // create the device manager
        using (Vintasoft.Twain.DeviceManager deviceManager = new Vintasoft.Twain.DeviceManager())
        {
            // specify that TWAIN device manager 2.x must be used
            deviceManager.IsTwain2Compatible = true;
            // specify that 64-bit TWAIN device manager 2.x must use 32-bit devices
            deviceManager.Use32BitDevices();
    
            // open the device manager
            deviceManager.Open();
    
            // show a dialog for selecting 32-bit TWAIN driver
            deviceManager.ShowDefaultDeviceSelectionDialog();
        }
    }