Although I can get the OCX to function properly the *first* time upon opening Internet Explorer, the OCX gives an error message the *second* time I try to run it.
In order to get it to work again, I have to close and reset Internet Explorer. It seems like there might be a memory leak of some sort. Perhaps you know what might be wrong.
Here is the debug error message:
End: OpenDefaultSource
RC: TWRC_FAILURE
CC: TWCC_MAXCONNECTIONS (DS is connected to max possible apps)
State: 3
Again, I can get to state 4 the first time, and the rest of the scan goes smoothly. But the second time, it gives me that error message.
Here is my source (vbscript):
Code: Select all
Set oTWAIN = CreateObject("gdtwain.twain")
oTWAIN.SetLicenseNumber("XXXXXXXXXXXXXXXXXXXXXXX")
oTWAIN.TwainOpenDefaultSource
oTWAIN.TwainHasFeeder()
oTWAIN.TWAINSetAutoFeed(TRUE)
nImageID = oTWAIN.TwainAcquireToImageID
If nImageID <> 0 Then
oTWAIN.SaveAsPdf ("c:\gdtwaintest.pdf")
oTWAIN.CloseImage (nImageID)
MsgBox "Save c:\gdtwaintest.pdf completed"
End If
oTWAIN.TwainCloseSource
oTWAIN.TwainUnloadSourceManager
oTWAIN.TwainCloseSourceManager