Home › Forums › TWAIN Classic › Close Data Source response slowly!(use User interface)
- This topic has 5 replies, 2 voices, and was last updated 13 years, 4 months ago by lik.
- AuthorPosts
I use VB6 write the twain driver.
When I test program without UI, everything is all right.
If I use scanner driver UI, I found that Close Data source is slowly(the long closing time ).It’s take about 3 second to run (DG_CONTROL, DAT_IDENTITY, MSG_CLOSEDS).And the scanner model is Kodak i1300.
but some scanner like fujitsu,hitachi use their UI is all right.
when I use Kodak scanner with UI, I can’t debug my program normally.
I can control the program in debug mode before I call the UI.
@lik wrote:
I use VB6 write the twain driver.
The rest of your message looks that you are writing a TWAIN application and not a TWAIN driver. Please clarify.
Best regards,
Kaij
@lik wrote:
I write twain driver by vb6.
And this driver is for Kodak, Hitachi and Fujitsu?
Best regards,
Kaij
@Kaij wrote:
@lik wrote:
I write twain driver by vb6.
And this driver is for Kodak, Hitachi and Fujitsu?
Best regards,
Kaij
Maybe my knowledge is poor.
VB6 can replace most of the C code in Twain_spec_2.1 PDF expect the event loop.
I can’t escape the loop, when I got the message is MSG_XFERREADY or MSG_CLOSEDSREQ.
GetMessage function always return the True value.
So, I use the goto command to force the program escape the loop.
I think it’s the reason that I use Kodak scanner non-normal response by UI mode.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Dim tEvent As TW_EVENT
Dim tMSG As MSG
‘
‘ Process events in the message loop
‘ DG_CONTROL, DAT_EVENT, MSG_PROCESSEVENT
‘
‘ There are two messages we are interested in in this message loop
‘ – MSG_XFERREADY – the data source is ready to transfer
‘ – MSG_CLOSEDSREQ – the data source requests to close itself
‘
‘
‘reference from page30 to page32 twain19.pdf by Alex
‘
Dim iRtn As EnumRC
Dim lRtn As LongWhile GetMessage(tMSG, 0&, 0&, 0&)
lRtn = TWRC_NOTDSEVENT
If m_DSOpen = True Then
Call ZeroMemory(VarPtr(tEvent), Len(tEvent))
tEvent.pEvent = VarPtr(tMSG)
iRtn = DSM_Entry(m_AppID, m_SrcID, DG_CONTROL, DAT_EVENT, _
MSG_PROCESSEVENT, tEvent)
Select Case tEvent.TWMessage
Case MSG_XFERREADY
If iRtn = TWRC_DSEVENT Then
m_State = TransferReady
GoTo MSGGET
End If
Case MSG_CLOSEDSREQ
GoTo CLOSEDSREQ
End Select
If iRtn = TWRC_NOTDSEVENT Then
lRtn = TranslateMessage(tMSG)
lRtn = DispatchMessage(tMSG)
End If
End IfWend
MSGGET:
WinMain = True
m_WinMain = WinMain
Exit Function
CLOSEDSREQ:
WinMain = False
m_WinMain = WinMain
Call ErrorHandle(TWRC_FAILURE)
End Function- AuthorPosts