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

Setting XferCount to -1

Forums › TWAIN Classic › Setting XferCount to -1

  • This topic has 1 reply, 2 voices, and was last updated 10 years, 2 months ago by peterp.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • October 29, 2010 at 3:54 pm #22640 Reply
    pu.mpkin
    Participant
    • Topics - 2
    • Replies - 1
    • Total Posts - 3

    Hi guys,

    in my application I am stucked on one problem and that is setting the count of images to be transfered to -1 (I have pasted my code below)

    The function is a real mystery to me. Everything looks fine. Every DSM call returns TWRC_SUCCESS, even when I check the current value of the capability it returns 65536 => -1.

    The only problem is that my camera want to close DS after every transfer.
    From DS i recieve MSG_XFERREADY, so I transfer image. BUT when I query the count of images to be transfered next, it ALWAYS returns 0 and next message I recieve from DSM is MSG_CLOSEDSREQ, so I have to close it.

    I am quite desperate because I need to grab images one after another to simulate “video stream”.

    I hope I have described my problem clear enough, if no please ask.

    bool TWSetXferCount(unsigned short count) {
    bool result = false;
    TW_UINT32 twRC;

    TW_CAPABILITY twCap;
    pTW_ONEVALUE pval;
    twCap.Cap = CAP_XFERCOUNT;
    twCap.ConType = TWON_ONEVALUE;
    twCap.hContainer = GlobalAlloc(GHND, sizeof(TW_ONEVALUE));
    pval = (pTW_ONEVALUE) GlobalLock(twCap.hContainer);
    pval->ItemType = TWTY_INT16;
    pval->Item = count;
    GlobalUnlock(twCap.hContainer);

    if((twRC=CallDSMEntry(&appID,
    &dsID,
    DG_CONTROL,
    DAT_CAPABILITY,
    MSG_SET,
    (TW_MEMREF)&twCap)) != TWRC_SUCCESS) {
    StatusText("Couldn't set the count of images");
    }

    GlobalFree((HANDLE)twCap.hContainer);

    // next I check the current value of the capability
    twCap.Cap = CAP_XFERCOUNT;
    twCap.ConType = TWON_DONTCARE16;
    twCap.hContainer = NULL;

    twRC = CallDSMEntry(&appID,
    &dsID,
    DG_CONTROL,
    DAT_CAPABILITY,
    MSG_GET,
    (TW_MEMREF)&twCap);

    pval = (pTW_ONEVALUE) GlobalLock(twCap.hContainer);
    if (count == pval->Item)
    result = true;
    else
    result = false;

    GlobalUnlock(twCap.hContainer);
    return result;
    }

    Thanks

    November 15, 2010 at 4:11 pm #25339 Reply
    peterp
    Participant
    • Topics - 0
    • Replies - 30
    • Total Posts - 30

    You appear to be doing everything correctly. There is no requirement that a data source has to allow you to transfer multiple images.

    If your data source is telling you there are no more images after you retreive one, then you need to disable or close the data source and then reopen or reenable it to get the next image. This is a design choice by the camera vendor.

    There may also be some custom capability to do continous scanning, but your camera vendor would be the only one who can tell you that.

  • Author
    Posts
Viewing 2 posts - 1 through 2 (of 2 total)
Reply To: Setting XferCount to -1
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

  • EPSON V600 TWAIN and WIA on Windows 10
  • When and how to use WaitForEvents command ?
  • Problem enumerating list of installed scanners in windows server 2012
  • Failed to create TWAIN progress! Error code is 1260.
  • To get the list of scanners from javascript client side (browser)
  • 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.