• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1939
  • Last Modified:

VB6 WIA Scanner Interface Problem With Document Feeder

Hi,

I have an interface that I had written in VB6 for HP Scanjet 6300 with auto document feeder.   The code scans the first page OK but then generates an error when it is suppose to load the next page.

The error I get is "438 Object doesn't support this property or method"  and this is the line that causes it:

NextNextWiaImg = WiaObj.ShowTransfer(itm)


Here is the rest of the code:



Private Sub cmdScan_Click()
Dim WiaObj As New WIA.CommonDialog
Dim WiaItm As WIA.Item
Dim WiaImg As New WIA.ImageFile
Dim wiadev As WIA.Device

If wiadev Is Nothing Then
' WiaDev is defined globally
Set wiadev = WiaObj.ShowSelectDevice(WIA.WiaDeviceType.ScannerDeviceType, True, False)
End If

Dim itm As WIA.Item
Dim ItmProp As WIA.Property
For Each itm In wiadev.Items
For Each ItmProp In itm.Properties
Select Case ItmProp.PropertyID
Case 6147:   ' Horizontal Resolution
            ItmProp.Value = 150
Case 6148:   ' Vertical Resolution
            ItmProp.Value = 150
Case 6151:   ' Horizontal Extent (Scanning Area)
            ItmProp.Value = 1275
Case 6152:   ' Vertical Extent (Scanning Area)
            ItmProp.Value = 550
Case 6149:   ' Horizontal Starting Position (Scanning Area)
            ItmProp.Value = 0
Case 6150:   ' Vertical Starting Position (Scanning Area)
            ItmProp.Value = 0
Case 6146:   ' Current Intent
            ItmProp.Value = 4
            ' Text or Line Art
End Select
NextNextWiaImg = WiaObj.ShowTransfer(itm)
Next
Next
0
lnwright
Asked:
lnwright
1 Solution
 
junglerover77Commented:
It's obvious that the following statement

NextNextWiaImg = WiaObj.ShowTransfer(itm)

should be outside the inner loop. Just change your code like:

Private Sub cmdScan_Click()
Dim WiaObj As New WIA.CommonDialog
Dim WiaItm As WIA.Item
Dim WiaImg As New WIA.ImageFile
Dim wiadev As WIA.Device

If wiadev Is Nothing Then
' WiaDev is defined globally
Set wiadev = WiaObj.ShowSelectDevice(WIA.WiaDeviceType.ScannerDeviceType, True, False)
End If

Dim itm As WIA.Item
Dim ItmProp As WIA.Property
For Each itm In wiadev.Items
For Each ItmProp In itm.Properties
Select Case ItmProp.PropertyID
Case 6147:   ' Horizontal Resolution
            ItmProp.Value = 150
Case 6148:   ' Vertical Resolution
            ItmProp.Value = 150
Case 6151:   ' Horizontal Extent (Scanning Area)
            ItmProp.Value = 1275
Case 6152:   ' Vertical Extent (Scanning Area)
            ItmProp.Value = 550
Case 6149:   ' Horizontal Starting Position (Scanning Area)
            ItmProp.Value = 0
Case 6150:   ' Vertical Starting Position (Scanning Area)
            ItmProp.Value = 0
Case 6146:   ' Current Intent
            ItmProp.Value = 4
            ' Text or Line Art
End Select
Next
NextNextWiaImg = WiaObj.ShowTransfer(itm)   'Move it outside the inner Loop!
Next

Regards,
Jungle
0

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now