Scanner Pro SDK ActiveX x64

Scanner Pro SDK ActiveX x64 2.0

Platform : Windows 10, Windows 8, Vista, Windows 7, XP

Scanner Pro ActiveX x64 Control for 64 bit and 32 bit MS Access, VB.NET, C#, Delphi and Visual C and 32 bit Visual Basic 6 and VFP.

VB.NET - How to use 32-bit TWAIN driver in 64-bit application?

Step 1: To install the Scanner Pro SDK ActiveX x64 Control, begin by launching the setup file (http://www.viscomsoft.com/demo/scannerpro-x64setup.exe). Select the desired installation folder for the Scanner Pro SDK ActiveX x64 Control and continue with the installation on your development computer.

Step 2: Create New Visual Basic Project, select Windows Application. 

Step 3: The next step is to install Scanner Pro SDK ActiveX x64 Control in ToolBox. Select Toolbox, select Components item, right click mouse button, select Choose Items...



Step 4: Select COM Components tab, select Scanner Pro SDK ActiveX x64 Control , click OK.

Step 5: Now you will see the Scanner Pro ActiveX x64's icon on toolbox, drag it to form.



Step 6: Create the UI like the following screen. It include some some buttons and combo boxes.

 

Step 7: In form load event, add the following code

 Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load

        cbodpi.Items.Add("Onscreen Viewing 96dpi")

        cbodpi.Items.Add("Fax 200dpi")

        cbodpi.Items.Add("OCR Text 300dpi")

        cbodpi.Items.Add("Laser Print Fine 600dpi")

        cbodpi.SelectedIndex = 0

        cbopixeltype.Items.Add("Default")

        cbopixeltype.Items.Add("Gray Color")

        cbopixeltype.Items.Add("Black & White Color")

        cbopixeltype.Items.Add("True Color")

        cbopixeltype.SelectedIndex = 0

 

    End Sub

Step 8: In btnConnect32BitBridge click event, add the following code

 Private Sub btnConnect32BitBridge_Click(sender As System.Object, e As System.EventArgs) Handles btnConnect32BitBridge.Click

        AxScanner1.Connect32bitTWAINBridge()

 

End Sub


Step 9: In btnDisconnect32BitBridge click event, add the following code

Private Sub btnDisconnect32BitBridge_Click(sender As System.Object, e As System.EventArgs) Handles btnDisconnect32BitBridge.Click

        AxScanner1.Disconnect32bitTWAINBridge()

 

End Sub

Step 10: If you want to work with 32-bit TWAIN driver from your 64-bit application. After connected Viscomsoft 32 bit TWAIN driver's Bridge (call Connect32bitTWAINBridge() ), it will fired Connected32bitTWAINBridge event. Add the following code in Connected32bitTWAINBridge event.

 

 Private Sub AxScanner1_Connected32bitTWAINBridge(sender As System.Object, e As System.EventArgs) Handles AxScanner1.Connected32bitTWAINBridge

        Dim iCount As Integer

        btnConnect32BitBridge.Enabled = False

        btnScan.Enabled = True

        btnDisconnect32BitBridge.Enabled = True

        iCount = Me.AxScanner1.GetNumImageSources

        For I = 0 To iCount - 1

            cboimagesource.Items.Add(AxScanner1.GetImageSourceName(I))

        Next

        If iCount > 0 Then

            cboimagesource.SelectedIndex = 0

        End If

End Sub

Step 11: In btnScan click event, add the following code

 Private Sub btnScan_Click(sender As System.Object, e As System.EventArgs) Handles btnScan.Click

        AxScanner1.SelectImageSourceByIndex(cboimagesource.SelectedIndex)

        If chkenablefeeder.Checked = True Then

            AxScanner1.FeederEnabled = True

        Else

            AxScanner1.FeederEnabled = False

        End If

 

        If chkclearimage.Checked = True Then

            AxScanner1.ClearImageBuffer = True

        Else

            AxScanner1.ClearImageBuffer = False

        End If

 

        Select Case cbodpi.SelectedIndex

            Case 0

                AxScanner1.DPI = 96

            Case 1

                AxScanner1.DPI = 200

            Case 2

                AxScanner1.DPI = 300

            Case 3

                AxScanner1.DPI = 600

        End Select

        Select Case cbopixeltype.SelectedIndex

            Case 0

                AxScanner1.PixelType = -1

            Case 1

                AxScanner1.PixelType = 0

            Case 2

                AxScanner1.PixelType = 1

            Case 3

                AxScanner1.PixelType = 2

        End Select

        AxScanner1.SetCaptureArea(0, 0, 0, 0)    

        AxScanner1.Scan()

 

End Sub

Step 12: In Scanner Pro ActiveX x64's End Scan event, add the following code

Private Sub AxScanner1_EndScan(sender As System.Object, e As System.EventArgs) Handles AxScanner1.EndScan

        lbltotalpage.Text = CStr(Me.AxScanner1.TotalPage)

        lblcurrentpage.Text = CStr(Me.AxScanner1.GetActivePageNo)
End Sub

Step 13: In Go button click event, add the following code

 Private Sub btnGo_Click(sender As System.Object, e As System.EventArgs) Handles btnGo.Click

        AxScanner1.SetActivePageNo(CShort(Text2.Text))

        lblcurrentpage.Text = CStr(Me.AxScanner1.GetActivePageNo)

 

End Sub

Step 14: Select Solution Platforms - Select Configuration Manager...



Step 15: In Active solution platform: Select <New...>

Step 16: Select x64 in Type or select the new platform:, then click OK.

 

Step 17: Make sure you selected x64 in Solution Platforms, press F5 to run the project. Now it run 64 bit application.



Step 18:  After run the project, click Connect 32 bit TWAIN Bridge button, then click Scan Image. PS - When you open the project in Visual Studio, if you want to edit the form, you must selected x86 first, if you selected x64, the Visual Studio Form designer does not support it. It will display error message. You need selected x86 , then close the project. then open the Visual Studio again.




Download this sample source code.