Home › Forums › TWAIN Classic › Source Manager hangs due to unconnected scanner
- This topic has 1 reply, 2 voices, and was last updated 11 years, 4 months ago by spike.
- AuthorPosts
Hello,
I have tested a few kinds od scanners and problems I have noticed are connected with HP scanners. HP scanners behave unexpectedly – they return errors which are inconsistent with documentation. I know that I should address to HP company with that.
But I have another problem, also with HP scanner. When I try to send OPENDS message, I receive exception “the server threw an exception”. I catch it – don’t know why it occures… Then I try to close DSM, but app hangs on CLOSEDSM message. I cannot do anything here but kill my app.. And on desktop still window from scanner is displayed, which dissapears after few minutes.
Is there any possibility to close all connections with devices and DSM regardless of the errors – to reset everything and eliminate possibility of app hanging?
Similar problem appeared when trying to enable unconnected web camera – how it is possible to open it and set capabilities?
But I have another problem, also with HP scanner. When I try to send OPENDS message, I receive exception “the server threw an exception”. I catch it – don’t know why it occures… Then I try to close DSM, but app hangs on CLOSEDSM message. I cannot do anything here but kill my app.. And on desktop still window from scanner is displayed, which dissapears after few minutes.
When a TWAIN driver crashes and throws an exception which it does not catch (which is, yes, bad design), the exception propagates out of the TWAIN manager and leaves it in an unstable state. Specifically, there is a serialization semaphore to prevent re-entrance. Any call into TWAIN after that will hang forever.
Is there any possibility to close all connections with devices and DSM regardless of the errors – to reset everything and eliminate possibility of app hanging?
Yes… it’s kind of nasty. You call FreeLibrary on the TWAIN manager until it unloads, then you can reload it and try again. I’m not sure about the crashed driver – if it doesn’t unload, then you get to search the loaded DLL list and force it to unload. Fairly dark magic.
Warning: If you do this repeatedly, you may develop a feeling that a giant invisible rabbit is following you everywhere.Similar problem appeared when trying to enable unconnected web camera – how it is possible to open it and set capabilities?
It’s not. Most TWAIN drivers won’t open successfully when their hardware isn’t online. I know it would be nice and the TWAIN spec says it might be possible. But no.
- AuthorPosts