Code: Select all
Private Function IsScannerReady(ByRef oScan As GdPicture.GdPictureImaging) As Boolean
Dim i As Integer
'set dpi
oScan.TwainSetResolution(intDPI)
'set UI
If blnHideUI = True Then
oScan.TwainSetHideUI(True)
Else
oScan.TwainSetHideUI(False)
End If
'set bitonal/color and make sure scanner supports color if selected
If strBitonalColor = "B" Then
'bitonal
oScan.TwainSetPixelType(TwainPixelType.TWPT_BW)
oScan.TwainSetBitDepth(1)
Else
'color
oScan.TwainSetPixelType(TwainPixelType.TWPT_RGB)
oScan.TwainSetBitDepth(8)
End If
'set auto brightness
oScan.TwainSetAutoBrightness(True)
'set duplex
If strSimplexDuplex = "D" Then
oScan.TwainEnableDuplex(True)
Else
'default to simplex
oScan.TwainEnableDuplex(False)
End If
'Set ADF
If blnADF = True Then
oScan.TwainSetAutoFeed(True)
oScan.TwainSetAutoScan(True)
Else
oScan.TwainSetAutoFeed(False)
End If
oScan.TwainSetAutoSize(True)
Return True
Exit Function
CatchError:
Return False
End Function