TWAIN Working Group

Newsletter Signup
Donate
Help keep TWAIN free
  • About TWAIN
    • What’s New?
    • News
    • Events
    • Membership
    • Consider a Donation
    • Contact Us
  • Why TWAIN?
  • Developers
    • Driver Developer
    • Application Developer
    • TWAIN Features
    • Specification & Tools
    • Self Certification Process
  • Support Forums
  • Scanner End-User
  • Find Certified Drivers
    • Facebook
    • LinkedIn
    • Vimeo

Reply To: Command line twain

Forums › TWAIN Classic › Command line twain › Reply To: Command line twain

August 1, 2007 at 7:09 am #23984
gabe
Participant
  • Topics - 9
  • Replies - 583
  • Total Posts - 592

problems with the code,

you havent provided a modified messageloop. You’re passing in a handle to twain, but you aren’t filtering(processing) messagages.

If you want the library to handle all of the twain calls for you then the class that talks to twain (in .net) should inherit from System.Windows.Forms.Form and Implement IMessageFilter.

Then in PreFilterMessage (that Implements MessageFilter.PreFilterMEssage) you’ll filter the messages that are coming in and do the appropriate thing. In that case you won’t pass a handle from the form to the library as the library will be using the handle to the above class to pass to twain
-or-
Or you can add Implements IMessageFilter to the main form (the one with the big red Scan button) and process the messages there.

In my mind the first alternative offers much more flexibility as the class can then be used from other project types that don’t (by default) have the messageloop appropriate for use with twain (like the Console Application or Windows Service templates).

I skimmed thru a bit of the code for some problems that seem to be common and a couple of things caught my eye.

Your TwCapability class doesn’t look right, if memory servers there should be a lookup (a huge select case statement or something) where you determine how much memory to reserve based on the cap that you’re trying to create

Your TwFix32 *may* work, but I think you are going to be off in your calculations when|if you encounter a negative number. TwFix32 is somewhat critical as a great deal of twain uses this structure or class – you might have it right, but I would double check.

Your TwImageInfo class doesn’t seem to be defined correctly, XResolution and YResolution are Fix32 not Int32.

There may be more (or the rest may be correct), but that was all I had time to look at right now. Feel free to catch me over IM or ask more questions here until you run out of questions.

.

Quick Links

Service Providers
TWAIN Support Forums
Membership
Contact Us
Privacy Policy

Newsletter Signup

TWAIN Working Group Family

TWAIN Working Group
TWAIN Direct®
TWAIN Resources
TWAIN Certified Drivers
PDF/raster

  • Facebook
  • GitHub
  • LinkedIn
  • Vimeo

Recent Topics

  • TWAIN for dental imaging integration
  • PDF/R For who and where?
  • Making searchable PDF with PDF/R
  • Backward compatibility with PDF/A and traditional PDF
  • could not open the twain source. Make sure there is a valid source for your sca
  • Quarterly Newsletter
  • TWAIN Working Group Membership
  • Logo Usage
  • TWAIN License
  • Contact Us
Privacy Policy • Privacy Tools • Copyright © 2021 TWAIN Working Group • by iHwy, LLC • Log in