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

Re: polling ICAP_FEEDERLOADED

Forums › TWAIN Classic › Simple TWAIN app question – reverse the process › Re: polling ICAP_FEEDERLOADED

December 19, 2009 at 5:49 am #25059
spike
Participant
  • Topics - 10
  • Replies - 139
  • Total Posts - 149

Hi eramgarden – I’d like to help, but the library you are using from CodeProject is kind of a hack – minimal comments, and almost everything done in-line. So for example there is no ‘Open the scanner’ function, nor are there the basic functions you need for reading capabilities. So I hope I’m getting this right…

The code that opens the scanner appears inside the Acquire method, here is one version I found, this is just the actual ‘open the scanner’ call:

		rc = DSMident( appid, IntPtr.Zero, TwDG.Control, TwDAT.Identity, TwMSG.OpenDS, srcds );
if( rc != TwRC.Success )
return;

If successful, that call will open the default TWAIN device.
Note that it depends on previous code that initializes the various variables like srcds and appid.

You’ll need to add this definition to the enum TwCap:

CAP_FEEDERLOADED = 0x1003

Once the scanner is in the open state, you could call


// create a capability structure with the capability code:
TwCapability cap = new TwCapability(TwCap.CAP_FEEDERLOADED);
// query the scanner for the current value of the capability:
rc = DScap( appid, srcds, TwDG.Control, TwDAT.Capability, TwMSG.Get, cap);
if( rc != TWRC.Success ) {
// something's wrong
CloseSrc();
return;
}
// Dig out the returned value of the capability.
// I'm going to ASSUME the returned container has
// ConType==TwOn.One.
// and contains a TWTY_BOOL value.
// Lock the container handle to get a pointer to its contents:
IntPtr pv = Twain.GlobalLock( cap.Handle );
// Read the 32-bit value of the container, it
// follows a 2-byte ItemType field in the container:
bool bFeederLoaded = ( 0 != (short)Marshal.ReadInt32( pv, 2 ) );
Twain.GlobalUnlock( cap.Handle );
Twain.GlobalFree( cap.Handle );

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

  • EPSON V600 TWAIN and WIA on Windows 10
  • When and how to use WaitForEvents command ?
  • Problem enumerating list of installed scanners in windows server 2012
  • Failed to create TWAIN progress! Error code is 1260.
  • To get the list of scanners from javascript client side (browser)
  • 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