You are here: GdPicture.NET > Documentation > Classes > GdPictureImaging Class > GdPictureImaging Methods > TWAIN Features > TwainIsBarcodeDetectionEnabled Method
logo.gif
ContentsIndexHome
PreviousUpNext
GdPictureImaging.TwainIsBarcodeDetectionEnabled Method

Asks to the opened source if the barcode detection capability is enabled or not.

C#
public Boolean TwainIsBarcodeDetectionEnabled();
Visual Basic
Public Function TwainIsBarcodeDetectionEnabled() As Boolean
Returns

Boolean. TRUE if the barcode detection is enabled, FALSE otherwise.

Before using this function check that the TWAIN state is TWAIN_SOURCE_OPEN (4) 

To get the TWAIN state, use the TwainGetState() function.

Acquire single image and detect its barcodes

    Private Sub Command1_Click(ByVal eventSender As System.Object, ByVal eventArgs As System.EventArgs) Handles Command4.Click
        Dim ImageID As Integer
        Dim oGdPictureImaging As New GdPicture.GdPictureImaging
 
        oGdPictureImaging.SetLicenseNumber("XXX") 'Replace XXX by a valid demo or commercial license KEY
        If oGdPictureImaging.TwainOpenDefaultSource(Me.Handle) Then
            If oGdPictureImaging.TwainIsBarcodeDetectionAvailable Then
                oGdPictureImaging.TwainSetBarcodeDetection(True)
                ImageID = oGdPictureImaging.TwainAcquireToGdPictureImage(Me.Handle)
                If ImageID <> 0 Then
                    Dim BarCodeCount As Integer = oGdPictureImaging.TwainBarCodeGetCount
 
                    MsgBox(Str(BarCodeCount) + " barcode have been found in the scanned image")
 
                    For i As Integer = 1 To BarCodeCount
                        MsgBox("Type of barcode " + Str(i) + " is: " + oGdPictureImaging.TwainBarCodeGetType(i).ToString)
                        MsgBox("Value of barcode " + Str(i) + " is: " + oGdPictureImaging.TwainBarCodeGetValue(i))
                    Next
 
                    oGdPictureImaging.ReleaseGdPictureImage(ImageID)
                End If
            Else
                MsgBox("Error: Barcode detection is not available on this scanner")
            End If
 
            oGdPictureImaging.TwainCloseSource()
            MsgBox("Done !")
        Else
            MsgBox("can't open default source, twain state is: " & oGdPictureImaging.TwainGetState.ToString)
        End If
    End Sub
What do you think about this topic? Send feedback!
Copyright (c) 2009-2011 www.gdpicture.com. All rights reserved.