Home › Forums › TWAIN Classic › detecting if feeder are ready or not
- This topic has 11 replies, 4 voices, and was last updated 16 years, 2 months ago by black_ghost.
- AuthorPosts
I just want a way to detect if feeder are ready, because in the State shows the same, and when I try to acquire it show a dialog saying that it don’t have paper, and I don’t want that dialog to show.
Is there a way to detect it?
Thanks
yes with CAP_PAPERDETECTABLE you can check if your source is able to detect paper and with CAP_FEEDERLOADED you can check if there is any paper in your feeder
I’m using eztw32.dll, how do I call CAP_FEEDERLOADED?
Something like GetCapCurrent?
DllCall(“eztw32TWAIN_GetCapCurrent”, UInt,0,UInt,”CAP_FEEDERLOADED”)
sorry have never had anything to do with eztw32, but you call and set cap_feederloaded the same way you set the resolution or bitdepth and so on.
Isn’t there just a way to disable all dialogs from twain?
what exactly do you mean with “disable all dialogs from twain”?
@formiga wrote:
Isn’t there just a way to disable all dialogs from twain?
no. you’ll have to write a dialog eater.
And how do I write a dialog eater without it blinks?
depends somewhat on how they send the dialog.
If they post the dialog to your handle you should be able to catch createWindow event with a cbtHook and the user will hear the error but (at least on my machines) the dialog is closed (post message with the controlId) before it even shows up. If however they run the dialog on another thread (I have a hp that does this)… then the cbt hook may not catch it (mine doesn’t). For those cases I have a second thread that I fire up to poll for windows that exist during the execution of the triplet that didn’t exist before the triplet was sent. Those dialogs show up for a moment before they’re closed. While the polling method is a bit slower (<100ms slower in most cases) it offers more accurate information (or I'm doing something wrong in my cbthook) In the cbthook the controlId is sometimes off, the controlId may be reported at 1 for OK and the polling thread says that the controlId for the ok button is 2. so far the detection with polling has never been wrong and the cbtHook has been *mostly* correct.someone elses sample boxeater:
http://cschubert.net/html/boxeater.html.
I’m using autohotkey, it hides the dialog, but it allways blink. I don’t know how to use cbthook. I see the link but don’t have a clue.
cbthooks are similar to the other hook types, you call SetWindowsHook (…or SetWindowsHookEx.. ) to set the hook and UnHookWindowsHook to unhook. If you looking to do dialogbox management they’re pretty useful. you should be able to find a bunch of examples on codeproject and msdn2. My use of them has been that you’ll typically set before OpenDs EnableDs and EnableDsUiOnly and unhook when those calls complete. If you have questions, just ask
Scanner: FUJITSU fi-5120C
CAP_FEEDERLOADED always shows TRUE in my program. Doesn’t matter whether the scanner has got papper or not.CheckCap((short)eTwCap.CAP_FEEDERLOADED, (short)eTwOn.One, eTwType.Bool)
private bool CheckCap(short type, short val, eTwType twType)
{
cTwCapability cap = new cTwCapability(type, val, twType);
eTwRC rc = DScap(m_appID, m_srcDS, eTwDG.Control, eTwDAT.Capability, eTwMSG.Get, cap);
if(rc == eTwRC.Failure)
return false;
return true;
}But when I use DOSADI TWIRL TWAIN Source Probe everything is allright – papper in – CAP_FEEDERLOADED is TRUE, papper out – CAP_FEEDERLOADED is FALSE.
What is a difference between eTwDAT.Identi-ty and eTwDAT.Capability. Which one I should use in this case?
- AuthorPosts