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: Question About ICAP_UNITS

Forums › TWAIN Classic › Question About ICAP_UNITS › Reply To: Question About ICAP_UNITS

February 13, 2008 at 2:50 pm #24336
torinford
Participant
  • Topics - 1
  • Replies - 8
  • Total Posts - 9

Hard to say if it is correct or not. I have to think my code is correct because the first two values I get back are 800 and 600, and both of these are available in the data source’s UI. The following is the code where I’m enumerating the ICAP_YRESOLUTION values.


TW_CAPABILITY twCapability;
memset(&twCapability, 0, sizeof(twCapability));
twCapability.Cap = ICAP_YRESOLUTION;
twCapability.ConType = TWON_ENUMERATION;

if ((Status = m_Twain.GetCapability(&twCapability)) != STATUS_SUCCESS)
{
return Status;
}

double dLargest = 0.0;
pTW_ENUMERATION pEnum = reinterpret_cast(::GlobalLock(twCapability.hContainer));
if (pEnum->ItemType != TWTY_FIX32)
{
::GlobalUnlock(twCapability.hContainer);
throw STATUS_NSTWAIN_UNSUPPORTED_DATA_TYPE;
}
else
{
double dTemp = 0.0;
pTW_FIX32 pFixResolution = reinterpret_cast(pEnum->ItemList);
TW_FIX32 FixResolution = { 0 };
TW_UINT32 uiItemCounter = 0;
for (uiItemCounter = 0; uiItemCounter < pEnum->NumItems; uiItemCounter++, pFixResolution++)
{
FixResolution = (*pFixResolution);

dTemp = static_cast(FixResolution.Whole) + (static_cast(FixResolution.Frac) / 65536.0);
if (dTemp > dLargest)
{
dLargest = dTemp;
}
}
}
::GlobalUnlock(twCapability.hContainer);

Due note, the negative and tiny values are seen in the FixResolution structure long before I do the conversion in to dTemp.

Thanks,

Torin

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