Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Thursday, September 13, 2007 12:39:15 PM(UTC)
adeptiveadam

Groups: Registered
Posts: 2


Hi I'm using the following code to detect if a scanner is connected when my application starts up:

	   try {
                if (TwainSession.IsAvailable(this)) {
                    TwainSession tw = new TwainSession();                   
                    tw.Startup(this, "", "", "", "");
                   TwainCapability tc = tw.GetCapability(TwainCapabilityType.DeviceOnline, TwainGetCapabilityMode.GetCurrent);
// set app vars here based on result
                   tw.Shutdown();
                   tw = null;
                }
            }
            catch {}

The problem is, if the scanner is not connected, LeadTools shows an error dialog that needs to be OKd before an exception is thrown. Is there anyway to suppress the error dialogs? Or is there another way to do this that won't show an error dialog?

Thanks,

Adam
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Friday, September 14, 2007 7:31:18 AM(UTC)

BoydP  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)

Unfortuneatly, this feature is not well supported in many devices.  Also, you are unable to ask if the device is online until you have actually opened the device, which kind of defeats the purpose of the feature.  This is part of the TWAIN specification and doing some searching about CAP_DEVICEONLINE yielded no easy way around this issue.

I would recommend disabling all scanning features when the exception is thrown and enable some option to select the TWAIN source.  When the user later selects a TWAIN source, perform the same check only enabling scanning options when tc.OneValueCapability.Value is true.
 
#3 Posted : Friday, September 14, 2007 7:37:20 AM(UTC)
adeptiveadam

Groups: Registered
Posts: 2


Thanks for your response..So there's no way to suppress the error dialogs?
 
#4 Posted : Friday, September 14, 2007 7:50:04 AM(UTC)

BoydP  
Guest

Groups: Guests
Posts: 3,022

Was thanked: 2 time(s) in 2 post(s)

I searched through all of our help files and was unable to find a return code of -4501.  As far as I can tell this is a TWAIN error dialog and there is no way to suppress it. 
 
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.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.064 seconds.