Check if Device is available without Dialogs?

Questions, comments and suggestions concerning VintaSoft Twain .NET SDK.

Moderator: Alex

Post Reply
dfboris
Posts: 8
Joined: Mon Nov 10, 2014 11:17 am

Check if Device is available without Dialogs?

Post by dfboris »

Problem:
- The DeviceManager has a list of installed Twain Devices. All installed Devices are listet in the Devices-List even if they are not connected.
- Example: I have installed the drivers for a Lide50 and for a DR-2050c. Now i see a lot of entries because every driver installs more than one device.

- Now i have the 2050c connected to the PC and this is the only Scanner-Device that is listed unter Windows -> Device Manager
- But the VintaSoft DeviceManager is giving me all Scanner-Devices that are possible: The Lide, some Webcams, the 2050c, ...

- If i try to open a Device that is not connected, i will get a Message that the device is not available. - Then i will run in the catch-code where i could handle that.

So: Is there any way to check for a Device being connected or not without getting any Windows-Messages/Dialogs?

My goal is: Only show devices that are really working, only devices that i could ".Open()" without error.

Edit: Oh, and i need this, because i like to Open() the Device to check if Duplex is available or not (I need this to offer this setting or to hide it from the user)

Thanks a lot
Alex
Site Admin
Posts: 2303
Joined: Thu Jul 10, 2008 2:21 pm

Re: Check if Device is available without Dialogs?

Post by Alex »

Hello Boris,

TWAIN device manager (TWAIN data source manager) provides you a list of TWAIN drivers installed in the system.

You need connect to the driver and try to open a device if you want to check the device status.

Best regards, Alexander
dfboris
Posts: 8
Joined: Mon Nov 10, 2014 11:17 am

Re: Check if Device is available without Dialogs?

Post by dfboris »

Yeah - but if the device is not connected (or switched off) there comes a Message before i can catch the error by myself.
I think that's right from the TWAIN-Interface so we cannot get around that (what means: We cannot filter out devices that are not connected - If TWAIN thinks they are there we have to live with that)

I thought there may be a way to check if a device is available or not without getting any System-Dialogs, because Windows is doing right that. If you look into the "System - Devices & Printers" you see just the connected scanner in the List of of Devices. If you switch of a scanner, it disapears from that list and comes back when you switch it on. (Think this is possible via the List of USB-Devices but i don't know how to get such Devices-List in a way that i could compare it with the List of TWAIN-Devices)
Alex
Site Admin
Posts: 2303
Joined: Thu Jul 10, 2008 2:21 pm

Re: Check if Device is available without Dialogs?

Post by Alex »

If you look into the "System - Devices & Printers" you see just the connected scanner in the List of of Devices
In the "System - Devices & Printers" you see DirectShow and WIA devices, this list does not contain TWAIN devices.

Many developers of TWAIN drivers show error or warning messages and you cannot disable them. Unfortunately, TWAIN standard is not ideal.

Best regards, Alexander
dfboris
Posts: 8
Joined: Mon Nov 10, 2014 11:17 am

Re: Check if Device is available without Dialogs?

Post by dfboris »

Yes, i think TWAIN is very old. Back then it was fine but then they forgot to put some modern features to it. Anyway - if i know it's not possible i can stop searching for it. That helps too :) Thank you
Post Reply