Is this function needed to read any barcodes or just certain ones? Do I need to purchase a separate license to read barcodes?
Private Sub fnTest()
Dim ImageID As Long
'Dim Twain1 As New GdPicture.GdPictureImaging
Dim BarCodeCount As Long
Dim i As Long
Dim sKey As String
Dim bRetVal As Boolean
Dim lRetVal As GdPictureStatus
Dim lW As Long
Dim lH As Long
sKey = "XXX"
bRetVal = Twain1.SetLicenseNumber(sKey) 'Replace XXX by a valid demo or commercial license KEY
bRetVal = Twain1.SetLicenseNumber1DBarcodeRecognition(sKey) 'Replace XXX by a valid demo or commercial license KEY
If Twain1.TwainOpenDefaultSource() Then
'If Twain1.TwainIsBarcodeDetectionAvailable Then
'bRetVal = Twain1.TwainSetBarcodeDetection(True)
Twain1.TwainSetHideUI (True)
Twain1.TwainSetIndicators (True)
Twain1.TwainSetAutoBrightness (True)
Twain1.TwainSetCurrentContrast (0)
Twain1.TwainEnableDuplex (False)
Twain1.TwainSetAutoFeed (True) ' // 'Set AutoFeed Enabled
Twain1.TwainSetAutoScan (True) ' // 'To achieve the maximum scanning rate
'Twain1.TwainSetCurrentResolution (72)
Twain1.TwainSetCurrentPixelType (TWPT_BW) ' //TWPT_GRAY); // 'RGB
Twain1.TwainSetCurrentBitDepth (8) ' // ' 24 bpp
'Twain1.TwainPdfStart('c:\\scanimg\\multipage.pdf', '', '', '', '')
ImageID = Twain1.TwainAcquireToGdPictureImage(Me.hWnd)
'DisplayNativeImage
lW = Twain1.GetWidth()
lH = Twain1.GetHeight()
Twain1.SetROI 0, 0, lW, lH
bRetVal = Twain1.TwainLogStart("c:\TwinLog.Log")
lRetVal = Twain1.Barcode1DReaderDoScan(BestQuality)
Twain1.TwainLogStop
For i = 1 To Twain1.Barcode1DReaderGetBarcodeCount
MsgBox "Value: " + Twain1.Barcode1DReaderGetBarcodeValue(i)
MsgBox "Type: " + Str(Twain1.Barcode1DReaderGetBarcodeType(i))
MsgBox "Angle: " + Str(Twain1.Barcode1DReaderGetBarcodeSkewAngle(i))
Next i
Twain1.Barcode1DReaderClear
Twain1.CloseNativeImage
Twain1.TwainCloseSource
MsgBox ("Done !")
Else
MsgBox ("can't open default source, twain state is: " & Twain1.TwainGetState)
End If
End Sub
TwainSaveAsTiff("test.tif")
Twain1.CloseNativeImageReturn to GdTwain [Pro] ActiveX
Users browsing this forum: No registered users and 1 guest