Is this a limitation with the driver, or is there something I need to do to capture the cancel button?
My code...
Code: Select all
Public Function Scan(ByVal settings As Settings, ByVal AddImageFunc As AddGDScannedImageDelegrate) As Boolean
If (settings.generateLog) Then
m_gd.TwainLogStart("c:\twainlog.txt")
End If
Dim bResult As Boolean = False
If m_gd.TwainOpenDefaultSource(Nothing) Then
Configure(settings)
Do
Dim iImageId As Integer = m_gd.TwainAcquireToGdPictureImage(Nothing)
If iImageId <> 0 Then
If (Not AddImageFunc(iImageId)) Then
m_gd.TwainCloseSource()
Return False
End If
End If
Loop While m_gd.TwainGetState > TwainStatus.TWAIN_SOURCE_ENABLED
m_gd.TwainCloseSource()
bResult = True
Else
MsgBox("can't open default source, twain state is: " & m_gd.TwainGetState.ToString)
bResult = False
End If
m_parent.BringToFront()
Return bResult
End Function