- This topic has 4 replies, 3 voices, and was last updated 7 years, 7 months ago by .
Viewing 5 posts - 1 through 5 (of 5 total)
Viewing 5 posts - 1 through 5 (of 5 total)
Forums › TWAIN Classic › TW_ONEVALUE structure with ItemType string
I’m maintaining a TWAIN driver and I encountered a situation where I’m not sure which is the expected/standard behaviour:
I’m receiving a value for setting a capability with ItemType TWTY_STR255. I saw the code example
pOneValue = (pTW_ONEVALUE)GlobalLock(hContainer);
if(pOneValue)
{
pOneValue->ItemType = TWTY_STR32;
pString = (pTW_STR32)&pOneValue->Item;
memcpy(pString, pInString, sizeof(TW_STR32));
GlobalUnlock(hContainer);
pOneValue = NULL;
pString = NULL;
}
which is functioning fine in most situations.
But I have an application (also developed here) which instead of a string sends a pointer, so that the driver has to cast
pString = (pTW_STR32)pOneValue->Item;
My dilemma is:
is this situation compliant with the TWAIN standard? Are there other applications which are expecting the same behaviour of the driver?
Thanks,
Daiana
Such issue happens. We also got similar problem before.
The first form is correct, the second form is wrong. In TWAIN the TW_ONEVALUE structure the “Item” field always contains the data, not a pointer to the data…
I just saw that Twacker also sends a pointer (char*)
🙁
Now I’m really confused
I’ll look into that…if true, it’s a bug…