EZTwain Pro 3.0 - Detecting Device On-Line

Overview  Download  Licensing  Features  Code Wizard  User Guide  Stories

How can I detect if a (TWAIN) device is on-line?

The official TWAIN way to ask if the device is "on-line" is to open the device and query the capability CAP_DEVICEONLINE. This was introduced in revision 1.6 of the TWAIN standard.

Unfortunately... You will find few devices that implement this correctly. So the truthful answer is: There is no good general way.

Still, if you are working with a specific device or family of devices, it is worth trying. Use TWAIN_OpenDefaultSource or TWAIN_OpenSource to open the device (remembering to check for success) - then try calling


This will attempt to read the value of this capability. This should return

0 if the device claims to be off-line
1 if the device claims to be on-line
2 if the device doesn't know.

Most probably, you will see an error dialog in the Open call, which will then fail. And you can't ask the device if it is on-line, until you get it open! Catch-22.

If this doesn't work, you could do something tricky about asking Windows directly about the USB device.