Thank you for the good answer.
I have discovered the unlock-stuff and now I can use document-capabilities of LeadTools. That was kind of stupid question, and I am sorry.
Further: What you say about same driver for a family of devices sounds very stupid, but I'm sure that it is a common practice of much vendors. Well, I have this question now: Is there other way to know for sure whether the TWAIN device is capable of automatic-feeding? I use the following C++ condition to know whether I can do ADF:
bool haveADF = (canDetectPaper() && haveLoadedPaper() && (canDoAutoFeed() || canFeedPage());
where:
=> canDetectPaper() returns "is CAP_PAPERDETECTABLE existing and if it is,
is its value TRUE?"
=> haveLoadedPaper() returns "is CAP_FEEDERLOADED existing and if it is,
is its value TRUE?"
=> canDoAutoFeed() returns "is CAP_AUTOFEED existing and if it is, is it
setable to TRUE?"
=> canFeedPage() returns "are CAP_EXTENDEDCAPS and CAP_FEEDPAGE existing,
if they are and if CAP_FEEDPAGE is not in CAP_EXTENDEDCAPS, is
CAP_FEEDPAGE add-able to CAP_EXTENDEDCAPS?"
For now, this seems to work on my very strange scanner, but I strongly doubt that this is an universal solution.
Sorry for the TWAIN-specific question here. I posted almost same question in TWAIN working group mailing list and so far I did not got the answer (a week passed since then). If you have any experience regarding this issue, please share it with me, I will be very grateful.
More: I am using Java-to-COM (and vice versa) library to work with LeadTools library (mostly TWAIN for now) in order to directly use Java proxy-classes to work with LeadTools library. Since the Java-to-COM/COM-to-Java library I use denies me to create "ICapability" (possible bug there, I have contacted its developer), I found myself forced to work with "ILEADTwainCapability" (plus "ICapability2", "ICapabilityOneValue2" etc.). Retrieving capability values works just fine (at least, works for one-value capabilities, I did not tried other container-types yet, but I expect no problems). But, when I want to set a capability, I receve either "Invalid parameter passed" or "TWAIN bad value". In the example I paste here, I try to change ICAP_PIXELTYPE, and I am SURE, that the capability and the value I assign it (2 == TWPT_RGB) are supported by my selected TWAIN source.
==> Here is the VB sample that LeadTools supplies:
Dim CapVal As Integer
Set TwainCap = New LEADRasterTwainCapability
TwainCap.CapInfo.ConType = L_TWON_ONEVALUE
TwainCap.CapInfo.Capability = L_ICAP_UNITS
TwainCap.EnableMethodErrors = False
CapVal = L_TWUN_INCHES
TwainCap.CapOneValue.OneValItemType = L_TWTY_UINT16
TwainCap.CapOneValue.OneValCapValue = CapVal
iRet = RasterTwain.SetCapability2(TwainCap, L_LTWAIN_CAPABILITY_SET)
==> Here is my JAVA code snippet:
ILEADTwainCapability _iltc = new ILEADTwainCapability (LEADTwainCapability.clsID);
_iltc.setEnableMethodErrors(true);
DispatchPtr _icap2 = (DispatchPtr) _iltc.get ("CapInfo");
_icap2.put ("ConType", 5);
_icap2.put ("Capability", 257);
DispatchPtr _icap21 = (DispatchPtr) _iltc.get ("CapOneValue");
_icap21.put ("OneValItemType", 4);
DispatchPtr _ltvr = (DispatchPtr) _icap21.get ("OneValCapValue");
_ltvr.put ("Type", 4);
_ltvr.put ("LongValue", 2);
_icap21.put ("OneValCapValue", _ltvr);
LeadUtil.ltCheck (ltrt.SetCapability2 (_iltc, 1)); // obviously, "ltrt" is of type "ILEADRasterTwain"
When "EnableMethodErrors" is "true", I receive error on the last-but-one-line -- "Ivalid parameter passed". When "EnableMethodErrors" is "false", I receive error on the last line: "TWAIN Bad Value Passed".
But that's not the worse. I was initally thinking that there must be some bug in the Java-to-COM/COM-to-Java library, but that's not the case. In C++ the things are 100% same. Here is my C++ code:
ILEADRasterTwain *ltrt; // instantiated & called InitSession() already.
ILEADTwainCapability *iltc = ... // intantiate new.
iltc->EnableMethodErrors = VARIANT_FALSE;
iltc->CapInfo->ConType = L_TWON_ONEVALUE;
iltc->CapInfo->Capability = L_ICAP_PIXELTYPE;
ILEADRasterVariant *var = ... // instantiate new.
var->Type = VALUE_BOOLEAN;
var->BooleanValue = TRUE;
iltc->CapOneValue->OneValItemType = L_TWTY_BOOL;
iltc->CapOneValue->OneValCapValue = var; // NOTE THIS LINE ALSO!
ltrt->EnableMethodErrors = VARIANT_FALSE;
short rc = ltrt->SetCapability2(iltc, L_LTWAIN_CAPABILITY_SET);
Here, "rc" becomes 20568. I tried many combinations, including extraction of "ICapability2" and "ICapabilityOneValue2" and storing them in variables, with no effect. Always the same error. More curious, on the line where I put a note (where we assign the variant to the capability-value) actually an error occurs. When I set "ILEADTwainCapabality" "EnableMethodErrors" to "true", on this line is thrown exception, whose user-error-code is 20013 (ERROR_INV_PARAMETER). I do not understand why.
I would be grateful if you give me EXACT directions on how to deal when SETTING capabilities and what's the problem of using VB-style (I do not know why it is VB-style) in C/C++ (even Java, through using proxy classes).
Regards,
Dimitar