LEADTOOLS Support
Imaging
Imaging SDK Questions
Re: Scanner Error - Driver in use by another program (-4539) and other related questions...
#1
Posted
:
Wednesday, November 8, 2006 9:33:46 AM(UTC)
Groups: Registered
Posts: 3
Has anyone encountered the following message: Scanner Error - Driver in use by another program (-4539)?
Is there a way to check the status of the twain driver prior to trying to use it?
Is there is a way to override this message and force an application to continue using the twain driver even though it thinks it is already in use?
Is there a way to reset the twain driver so that it is not in use?
I am using VB6 and the Raster Imaging Pro toolkit v14.
#2
Posted
:
Thursday, November 9, 2006 5:40:15 AM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
Does this error happen always or under certain
circumstances?
Also, does it only happen in your application, or
using our demo projects? What about non-LEAD applications, do they work
correctly?
#3
Posted
:
Tuesday, November 14, 2006 10:43:21 AM(UTC)
Groups: Registered
Posts: 3
Qasem:
I was given a very important detail this morning concerning this error that I didn't realize before. Here is what is happening. The end-user is opening up my VB application which uses the twain driver for the scanner and leaving the application open. The end-user is then opening Ascent Capture, which uses the ISIS driver for the scanner, does some scanning and leaves Ascent Capture open. The end-user then goes back to the VB application and tries to scan using the Twain driver and the error "Driver in use by another program (-4539) occurs.
Does LeadTools have any way of detecting if the scanner is already being used so I can prevent the application from attempting to try and use the Twain driver and causing an error?
Thanks for your help,
Rod
#4
Posted
:
Wednesday, November 15, 2006 5:26:05 AM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
You can try to use the CAP_DEVICEONLINE capability,
which Determines if hardware is on and ready, but the result will depend on how
the Twain driver is implemented so it's not guaranteed to work.
Please note that the error code you're getting is not
from LEADTOOLS. It is from the Twain driver itself
#5
Posted
:
Thursday, February 1, 2007 6:36:28 AM(UTC)
Groups: Registered
Posts: 4
I am currently experiencing this kind of problem. (concurrent accesses to same scanner)
The main problem is with the Startup() method of the TwainSession object. Since they actually don't test if source can be opened or not. I believe this is done at the first capability access.
I manage to make it work for concurrent accesses by adding a property to my wrapper class.
it looks like that
Code:
public bool ScannerAvailable
{
get
{
// Test a get capability once just to be sure we can open the Source. If source is occupied (TWCC_MAXCONNECTIONS)
// for example, then this method will crash. Session has to be Startup()ed
try
{
int test = _tw.SupportedCapabilities.Length;
return true;
}
catch
{
return false;
}
}
}
Just test it after the Startup() to be sure you are really started.
Then you just have to add a timer to shutdown after being inactive and that's over.
I was believing the Startup method will throw when device is busy but this is not the case.
Edited by moderator Tuesday, November 22, 2016 10:23:19 AM(UTC)
| Reason: Added code tags
#6
Posted
:
Sunday, February 4, 2007 3:41:44 AM(UTC)
Groups: Guests
Posts: 3,022
Was thanked: 2 time(s) in 2 post(s)
Thank you for your post and the useful information.
The TwainSession.IsAvailable as well as the
TwainSession.Startup methods do not load the individual Twain drivers (a PC can
have more than one), but only access the Twain source manager.
LEADTOOLS Support
Imaging
Imaging SDK Questions
Re: Scanner Error - Driver in use by another program (-4539) and other related questions...
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.