Home › Forums › TWAIN Classic › Preview
- This topic has 6 replies, 3 voices, and was last updated 16 years, 7 months ago by gabe.
- AuthorPosts
1. How to get a preview before actual scan (acquire)
using GETFIRSTFILE?2. How to get error messages in my app, like “Calibrate first, papers not ready(I saw a tag for that) but any event message from the device?
Would anyone help with a piece of code in C#?
I see lot of SPAM messages here? aren’t Twain guys cleaning their shop….
1. if you mean with GETFIRSTFILE msg_getfirstfile than I don’t understand what this has to do with a scan preview.
for a scan preview I would suggest you do a normal scan just with a very low resolution and display it on the screen.2. be a bit more specific in terms of what you are using for your app: any predefined commands, twack-commands, …..
what kind of error messages are you thinking of? errors occurring during setting the caps, the transfer,… or wrong input from the user?Calibrate first, papers not ready or any event message from the device happens when?
You are saying GetFirstFile has nothing to do with pre scan preview and and only to show a preview is to scan the first page and put the up to user?
MSG_GETFIRSTFILE has nothing to do with a preview scan because it gets you the first file name in a folder see spec 1.9 page 174
to scan the first page and display is is ONE possibility to do a preview scan. maybe there are others but I couldn’t think of anysorry, but I still have no idea what you mean with your event messages. the device will never ask to be calibrated becaust it is always calibrated with default settings.
if you want to check if there is any paper to be scanned than you have to swicht to automatic document feeder mode IF your scanner supports this, otherwise I don’t think that a scanner can tell if there is any paper to be scanned or notNo, some scanner I saw needs to be first to be calibrated,
Or things like papers not found message box pops up, I want that message transfered to my app, where I would show the message in a level or own messgebox. all the messages generated from a user command to the scanner to be captured by my app just that what I want.well I don’t think these are error messages from the scanner, but only from the application.
So I would suggest you just add a function to your application, which comes up with an error box if the user tries to scan before having finished the settings.
what does your app look like so far? do you already have some code?@Som wrote:
Or things like papers not found message box pops up,
you don’t like the vendor’s messagebox stopping your triplet? No kidding. That’s frustrating. No, there is no twain call to turn them off.
I want that message transfered to my app, where I would show the message in a level or own messgebox. all the messages generated from a user command to the scanner to be captured by my app just that what I want.
Unfortunately those messages aren’t always available, and there really isn’t a way (from within the twain spec) to get them trasnfered to your app.
My workaround ended up being a second thread that does dialog management for me. I set a shell hook and a second cbt hook for windowactivated/created. then I have the users do stupid stuff like turn off the scanner and try to acquire, or jam a paper in the feeder before trying to acquire. typically you’ll have to watch for the dialogs around the time you call openDs, enableDs or enableDsUiOnly. If any dialogs come up that second thread steps thru it and gathers details to base a rule on for the dialog monitor. In general use the dialog monitor will have an array of meesagesboxes to watch out for and what to do if they show up – usually a postmessage to the ok or Cancel buttons. Worst case is if the users havent made rules for all of the possible messageboxes but the details are logged. When the cbthook catches the dialog you don’t even see it, just hear the beep. The shellhook isn’t as fast – you’ll often see a flash of messagebox before it gets closed.
Once you have that out of the way you’re able to go back to work on the rest of the spec, but I’d have to say that dialog management is key if you’re going to get any production work out of a mid-range scanner.
.
- AuthorPosts