LEADTOOLS Support
General
General Questions
Re: Suppress error dialogs when checking if scanner connected
This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Thursday, September 13, 2007 12:39:15 PM(UTC)
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
#2
Posted
:
Friday, September 14, 2007 7:31:18 AM(UTC)
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)
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)
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.
LEADTOOLS Support
General
General Questions
Re: Suppress error dialogs when checking if scanner connected
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.