Detect Scanner Not Available

Questions, comments and suggestions concerning VintaSoft Twain ActiveX.

Moderator: Alex

Post Reply
micthom
Posts: 1
Joined: Thu Nov 15, 2018 10:53 pm

Detect Scanner Not Available

Post by micthom » Thu Nov 15, 2018 9:13 pm

Is there an API or "cap" in TWAIN that I can detect if the scanner if offline or not available. I want to grey out the a 'Scan' button in my application if the scanner is not connected to turned off.

Alex
Site Admin
Posts: 1588
Joined: Thu Jul 10, 2008 2:21 pm

Re: Detect Scanner Not Available

Post by Alex » Fri Nov 16, 2018 5:54 pm

Hello,
micthom wrote:
Thu Nov 15, 2018 9:13 pm
Is there an API or "cap" in TWAIN that I can detect if the scanner if offline or not available. I want to grey out the a 'Scan' button in my application if the scanner is not connected to turned off.
If you want to detect that scanner is offline or not available, you need do the following steps:
  • Try to open the scanner using the Device_Open method: https://www.vintasoft.com/docs/vstwain/ ... _Open.html
    Scanner is not available if method fails.
  • If the Device_Open method is executed successfully, try to get value of DeviceCapabilityId.DeviceOnline capability.
    Scanner is offline if capability value is False.
Best regards, Alexander

Post Reply