ImageEn for Delphi and C++ Builder ImageEn for Delphi and C++ Builder

 

ImageEn Forum
Profile    Join    Active Topics    Forum FAQ    Search this forumSearch
 All Forums
 ImageEn Library for Delphi, C++ and .Net
 ImageEn and IEvolution Support Forum
 How to handle disconnected scanner

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

View 
UserName:
Password:
Format  Bold Italicized Underline  Align Left Centered Align Right  Horizontal Rule  Insert Hyperlink   Browse for an image to attach to your post Browse for a zip to attach to your post Insert Code  Insert Quote Insert List
   
Message 

 

Emoji
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Black Eye [B)]
Frown [:(] Shocked [:0] Angry [:(!] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
Homer Posted - Jan 05 2022 : 18:56:13
I disconnected my scanner's USB cable to emulate a missing or disconnected scanner. This code causes the following message. That message appears to be from my scanner's driver. The line of code is the first attempt to communicate with the scanner. It's done as the main form opens.
ImageEnMView1.MIO.AcquireParams.DuplexEnabled;

Is there a way to trap the appearance of this warning so that my code can behave accordingly. If not, I need to know how to see if there are any connected devices. I've tried putting this in a try/except block, but it doesn't actually throw an exception.



BTW, I execute that line of code because I learned that calling AcquireParams once, where it won't be noticed, makes all subsequent calls much faster. I don't do anything with the return value. Its only purpose is to speed up the opening of my homemade scanner dialog.
3   L A T E S T    R E P L I E S    (Newest First)
Homer Posted - Jan 07 2022 : 00:50:09
Thanks. I thought that was it.
xequte Posted - Jan 07 2022 : 00:21:10
Hi

Generally DeviceOnline should be the correct one to use, but it is only available for Twain devices so you would need to ensure SelectedAcquireSource.Api is ieaTwain

https://www.imageen.com/help/TImageEnIO.SelectedAcquireSource.html

Nigel
Xequte Software
www.imageen.com
Homer Posted - Jan 06 2022 : 11:35:18
Is this a good solution? I set a global boolean variable based on the AcquireParams.PhysicalWidthPixels return value. My assumption is, it should always be > 0. My concern is, what happens if a scanner is on and connected, but simply doesn't return this value?

I've tried this, and it works with my HP scanner.
gbScannerAvailable := ImageEnMView1.MIO.AcquireParams.PhysicalWidthPixels > 0 ;



But this looks better.
gbScannerAvailable := ImageEnView1.IO.TwainParams.DeviceOnline;


Anyone with experience trapping a disconnected scanner or one that is off?