Home › Forums › TWAIN Classic › Force Reset
- This topic has 1 reply, 2 voices, and was last updated 16 years, 3 months ago by gabe.
- AuthorPosts
In debugging, sometimes I stop my scan program and suspect I am leaving the scanner in a non-initial state, so when I go to rerun the program I fail to communicate with the scanner.
How do I:
1. Determine which state I am at?
2. Force a state reset, regardless of where I’m at?Also: is there a handy summary of all possible DSM_Entry triplets anywhere?
sometimes I stop my scan program and suspect I am leaving the scanner in a non-initial state, so when I go to rerun the program I fail to communicate with the scanner.
you shouldn’t do that.
How do I:
1. Determine which state I am at?you track it by hand. I use a member variable. it’s tedious, and the #2 problem that everyone using NetMasters code suffers through if they really want to program with twain using his interop sample.
2. Force a state reset, regardless of where I’m at?
the power switch on the scanner (and occasionally the one on your workstation). Short of a power button my exit routine typically calls
Control/UserInterface/DisableDs, Control/Ident ity/CloseDS() &
Control/Parent/CloseDSM() but then I also track the twState and havent run into a situation where I need to force reset where anything short of a power button righted the wrongs. But to be fair, if devices act flaky I don’t continue to use them. Time costs more than hardware in the midrange scanner class.Also: is there a handy summary of all possible DSM_Entry triplets anywhere?
I thought the twain spec was pretty handy, your mileage may vary. Personally the last section of chapter 7 is my favorite.
.
- AuthorPosts