 VB
 VBThis example uses SetScanCapability to specify the Image Type for scanning, without using the scanner's TWAIN dialog box.
Private Sub cmdSetImgType_Click() 'User is given the option to select an Image Type for scanning 'of black and white, grayscale or color. The option selected 'is stored in the global variable ScanType. Const IT_BW = 1Const IT_GRAY8 = 4Const IT_RGB = 16Const CAP_SCAN_IMAGE_TYPE = 100Const CAP_SCAN_IMAGE_TYPES_SUPPORTED = 1Dim varScanImgType As Variant'Global Scantype as integer'Scanner must be open for Capability check.ImgScan1.OpenScanner'See what image types the scanner supports.varScanImgType =_ImgScan1.GetScanCapability(CAP
SCAN_IMAGE_TYPES_SUPPORTED)If VarType(varScanImgType) = vbError ThenMsgBox "Unable to get Supported Image Types"End If'Find out if the type the user selected is supported; 'if so set the capability to that image typeSelect Case ScanTypeCase 1If varScanImgType And IT_BW ThenImgScan1.SetScanCapability CAP_SCAN_IMAGE_TYPE, IT_BWElseMsgBox "Black & White image type is not supported by your scanner"End IfCase 2If varScanImgType And IT_GRAY8 ThenImgScan1.SetScanCapability CAP_SCAN_IMAGE_TYPE, IT_GRAY8ElseMsgBox "Grayscale image type is not supported by your scanner"End IfCase 3If varScanImgType And IT_RGB ThenImgScan1.SetScanCapability CAP_SCAN_IMAGE_TYPE, IT_RGBElseMsgBox "Color image type is not supported by your scanner"End IfEnd SelectEnd Sub