Home › Forums › TWAIN Classic › ICAP_XRESOLUTION rare values
- This topic has 3 replies, 2 voices, and was last updated 15 years, 10 months ago by june5.
- AuthorPosts
Hello, I´m Sergio from Spain. I´m making a program which manage twain driver for scanning. I have got the following code:
twCapability.Cap=ICAP_XRESOLUTION;
twCapability.ConType=TWON_DONTCARE16;
twCapability.hContainer=GlobalAlloc(GHND,sizeof(TW_RANGE));Rc=(*pDSM_Entry) ((TW_IDENTITY*)MainIdentity,(TW_IDENTITY*)&SourceIdentity,DG_CONTROL,DAT_CAPABILITY,MSG_GET,(TW_MEMREF)&twCapability);
if(Rc==TWRC_SUCCESS)
{
TW_RANGE pRange=(pTW_RANGE)GlobalLock(twCapability.hContainer);if ((TW_UINT16)pRange->ItemType == TWTY_FIX32)
{
//Store Item Value
pTWFix32 = &(pRange->MaxValue);
valueF32 = FIX32ToFloat(*pTWFix32);
MaxResolution = valueF32;pTWFix32 = &(pRange->MinValue);
valueF32 = FIX32ToFloat(*pTWFix32);
MinResolution = valueF32;
}GlobalUnlock(twCapability.hContainer);
}When I test it with a Fujitsu fi-4010CU, I obtain correct values such as pRange->MaxValue = 600, pRange->MinValue = 50, pRange->StepSize = 1, pRange->DefaultValue = 300. But when I test the same with a Canon DR2050C, I obtain this: pRange->MaxValue = 4, pRange->MinValue = 7, pRange->StepSize = 4, pRange->DefaultValue = 100, pRange->CurrentValue = 150.
I also have been proving with twCapability.ConType= TWON_RANGE, TWON_ENUMERATION, TWON_ONEVALUE but the results have been the same.
I don’t know how to interpret Canon DR2050C values because the maximun resolution is 600×600 dpi and not 4×4 dpi. I also don’t know if these values are correct or incorrect.
Thank you for your assistance.
In case of DR2050C, ConType is TWON_ENUMERATION.
> pRange->MaxValue = 4, pRange->MinValue = 7, pRange->StepSize = 4
It means NumItems=7, CurrentIndex=4, DefaultIndex=4. You can get 7 items, I think.
Thank you very much for your reply. Now, I know how to obtain all the possible resolution values of my scanner from TW_ENUMERATION struct.
I also have got another doubt. Trying to do my application more general and wanting it works with a large amount of scanners, I´d like to know if there is a way or a mechanism to know in which type of capability structure (TW_RANGE, TW_ENNUMERATION…) one scanner returns me its capability values. If I know this information I will be able to know in which structure I should look for the values I want.
Thanks.
😉
Check twCapability.ConType returned by the driver. If it is TWON_RANGE, you need to cast hContainer into pTW_RANGE; if TWON_ENUMERATION, into pTW_ENUMERATION.
- AuthorPosts