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

Mulli Image Scanning

Forums › TWAIN Classic › Mulli Image Scanning

  • This topic has 3 replies, 3 voices, and was last updated 12 years, 3 months ago by jimwatters.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • October 9, 2008 at 7:24 am #22418 Reply
    amila123
    Participant
    • Topics - 11
    • Replies - 5
    • Total Posts - 16

    Hi..

    I have a java scanner application.that call twain wrapper (C++).
    I opendsm,opends and enableds ,then after coming the scanner window.
    I pressed scan button,then just scan a one page(I have loaded 10 pages in my ADF scanner).
    How to do that acquire all pages,by pressing scan button
    Thnx

    Regrads
    Amila

    October 15, 2008 at 10:42 am #24683 Reply
    npcs
    Participant
    • Topics - 0
    • Replies - 1
    • Total Posts - 1

    You need to set cap_xfercount to -1, it will scan all the pages in the feeder.

    @amila123 wrote:

    Hi..

    I have a java scanner application.that call twain wrapper (C++).
    I opendsm,opends and enableds ,then after coming the scanner window.
    I pressed scan button,then just scan a one page(I have loaded 10 pages in my ADF scanner).
    How to do that acquire all pages,by pressing scan button
    Thnx

    Regrads
    Amila

    October 16, 2008 at 10:06 am #24684 Reply
    amila123
    Participant
    • Topics - 11
    • Replies - 5
    • Total Posts - 16

    I set CAP_XFERCOUNT as -1. my code is below

    TW_CAPABILITY twCapability;
    pTW_ONEVALUE pval;

    twCapability.Cap = CAP_XFERCOUNT;
    twCapability.ConType = TWON_ONEVALUE;
    twCapability.hContainer = GlobalAlloc (GHND, sizeof (TW_ONEVALUE));
    pval = (pTW_ONEVALUE) GlobalLock (twCapability.hContainer);
    pval->ItemType = TWTY_INT16;
    pval->Item = -1;
    GlobalUnlock(twCapability.hContainer);
    g_rc = (*DSM_ENTRY) (&g_AppID, &g_SrcID, DG_CONTROL, DAT_CAPABILITY, MSG_SET, ( TW_MEMREF)&twCapability);
    if(g_rc == TWRC_SUCCESS)
    printf(“CAP_XFERCOUNT Succ n”);
    else
    printf(“CAP_XFERCOUNT failed n”);

    /*


    */

    TW_USERINTERFACE ui;

    ui.ShowUI = TRUE;
    ui.ModalUI = TRUE;
    ui.hParent = 0;

    g_rc = (*DSM_ENTRY) (&g_AppID,&g_SrcID,DG_CONTROL,DAT_USERINTERFACE,MSG_ENABLEDS,&ui);
    if (g_rc != TWRC_SUCCESS)
    {
    JNU_Throwexception(env,”scanner/TwainException”,”Unable to enableDS”);
    }

    bool nonTWAINProblem = FALSE;
    MSG msg;
    TW_EVENT event;
    TW_PENDINGXFERS pxfers;

    do
    {
    event.pEvent = (TW_MEMREF) &msg;
    event.TWMessage = MSG_NULL;

    g_rc = (*DSM_ENTRY) (&g_AppID,&g_SrcID,DG_CONTROL,DAT_EVENT,MSG_PROCESSEVENT,(TW_MEMREF) &event);

    if (g_rc == TWRC_NOTDSEVENT)
    {
    TranslateMessage ((LPMSG) &msg);
    DispatchMessage ((LPMSG) &msg);
    continue;
    }

    if (event.TWMessage == MSG_XFERREADY)
    {
    nextImage:
    TW_IMAGEINFO ii;
    g_rc = (*DSM_ENTRY) (&g_AppID,&g_SrcID,DG_IMAGE,DAT_IMAGEINFO,MSG_GET,(TW_MEMREF) &ii);

    if (g_rc == TWRC_FAILURE)
    {
    (*DSM_ENTRY) (&g_AppID,&g_SrcID,DG_CONTROL,DAT_PENDINGXFERS,MSG_RESET,(TW_MEMREF) &pxfers);
    JNU_Throwexception(env,”TwainException”,”Unable to obtain image Info”);
    break;
    }

    HGLOBAL handle;

    g_rc = (*DSM_ENTRY) (&g_AppID,&g_SrcID,DG_IMAGE,DAT_IMAGENATIVEXFER,MSG_GET,(TW_MEMREF) &handle);
    if (g_rc == TWRC_XFERDONE)
    {
    BITMAPINFOHEADER* lpbmih=(BITMAPINFOHEADER*)GlobalLock(handle);
    jboolean no=JNI_FALSE;
    image = BMP_transferImage(env,clazz,&no,(HGLOBAL)handle);

    GlobalUnlock ((HANDLE) handle);
    GlobalFree ((HANDLE) handle);

    g_rc = (*DSM_ENTRY) (&g_AppID,&g_SrcID,DG_CONTROL,DAT_PENDINGXFERS,MSG_ENDXFER,(TW_MEMREF) &pxfers);
    }
    (*DSM_ENTRY) (&g_AppID,&g_SrcID,DG_CONTROL,DAT_PENDINGXFERS,MSG_RESET,(TW_MEMREF) &pxfers);
    }
    }while (GetMessage ((LPMSG) &msg, 0, 0, 0) && pxfers.Count != 0);

    It just scan one page..what can be the problem ?

    Regards
    Amila

    October 21, 2008 at 5:23 pm #24685 Reply
    jimwatters
    Participant
    • Topics - 2
    • Replies - 72
    • Total Posts - 74

    I believe your last call with DG_CONTROL,DAT_PENDINGXFERS,MSG_RESET inside your do loop is to blame. Remove this.

    (*DSM_ENTRY) (&g_AppID,&g_SrcID,DG_CONTROL,DAT_PENDINGXFERS,MSG_RESET,(TW_MEMREF) &pxfers); 
  • Author
    Posts
Viewing 4 posts - 1 through 4 (of 4 total)
Reply To: Mulli Image Scanning
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.