Home › Forums › TWAIN Classic › Question About ICAP_UNITS › Reply To: Question About ICAP_UNITS
February 13, 2008 at 2:50 pm #24336
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