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

TW_ONEVALUE structure with ItemType string

Forums › TWAIN Classic › TW_ONEVALUE structure with ItemType string

  • This topic has 4 replies, 3 voices, and was last updated 7 years, 7 months ago by MarkM.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • May 28, 2013 at 1:37 pm #22847 Reply
    xdaiana
    Participant
    • Topics - 3
    • Replies - 6
    • Total Posts - 9

    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

    May 29, 2013 at 10:27 am #25890 Reply
    Catherine Sea
    Participant
    • Topics - 0
    • Replies - 59
    • Total Posts - 59

    Such issue happens. We also got similar problem before.

    June 4, 2013 at 6:58 pm #25891 Reply
    MarkM
    Participant
    • Topics - 1
    • Replies - 135
    • Total Posts - 136

    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…

    July 16, 2013 at 1:27 pm #25892 Reply
    xdaiana
    Participant
    • Topics - 3
    • Replies - 6
    • Total Posts - 9

    I just saw that Twacker also sends a pointer (char*)
    🙁
    Now I’m really confused

    July 18, 2013 at 12:28 pm #25893 Reply
    MarkM
    Participant
    • Topics - 1
    • Replies - 135
    • Total Posts - 136

    I’ll look into that…if true, it’s a bug…

  • Author
    Posts
Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: TW_ONEVALUE structure with ItemType string
Your information:




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

  • could not open the twain source. Make sure there is a valid source for your sca
  • Changing TWAIN driver defaults
  • Scanner starts transfer when console gets closed (CITRIX)
  • Kodak RFS 3600
  • Didn’t save enough file scan
  • 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

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.