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

Twain Data Source in Windows 7

Forums › TWAIN Classic › Twain Data Source in Windows 7

  • This topic has 4 replies, 2 voices, and was last updated 8 years, 2 months ago by spike.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • January 5, 2013 at 7:39 pm #22814 Reply
    shujaat
    Participant
    • Topics - 2
    • Replies - 2
    • Total Posts - 4

    Is there any known issue with Sample Twain Data Source on Windows 7? I have spent 2 full days digging this. I’m using .NET 4.0 with C# and VS2010 to write an application that could talk to the Sample DS and get that single image from it. But I get a Failure status in DataSource.Enable() function. I have tried both enabling and disabling UI dialog, but it doesn’t help. When I enable UI, the TWAIN DS dialog appears, showing all the settings of the Sample DS, but clicking the Scan button doesn’t do anything.

    Interestingly, the same application works just fine on Windows XP. Also, the Twain sample application that is bundled with the Sample DS can talk to the DS without any problem.

    Prompt answer will hugely be appreciated.

    Shujaat

    January 8, 2013 at 10:03 pm #25778 Reply
    spike
    Participant
    • Topics - 10
    • Replies - 139
    • Total Posts - 149

    That sounds like it could be a message handling problem, or an XFERREADY handling problem.
    When you enable with the UI, is the dialog ‘live’ and responsive otherwise? You can change settings?
    Or the problem appears only when you click the Scan button?

    I assume you are building your app with Target=x86.
    Which TWAIN Manager are you using, twain_32.dll, or twaindsm.dll?
    Does your application describe itself as a TWAIN 2.0 app or not?
    How are you handling MSG_XFERREADY – do you use message forwarding (MSG_PROCESSEVENT) or does your code set up a call-back handler using MSG_REGISTER_CALLBACK?

    January 16, 2013 at 7:15 am #25779 Reply
    shujaat
    Participant
    • Topics - 2
    • Replies - 2
    • Total Posts - 4

    Thanks Spike. Answering your questions:

    Yes, the dialog is LIVE. I can click on things and change settings where available. But clicking the Scan (or Cancel) button do not do anything, as if nothing had happened.

    Yes. The target is x86.

    Which TWAIN Manager are you using, twain_32.dll, or twaindsm.dll?

    How do I find out the TWAIN Manager I’m using and how does an application describe itself as a TWAIN 2.0 app?

    About those message handlers, this is a managed .net C# application, so all those kind of stuff is normally handled by default.

    January 16, 2013 at 7:25 am #25780 Reply
    shujaat
    Participant
    • Topics - 2
    • Replies - 2
    • Total Posts - 4

    In fact, TWAIN’s UI settings are sometimes unchangable. They DO respond to keyboard and mouse, but do not allow changing the selected values.

    I also found that the underlying DLL that is being called is “twain_32.dll”, but “twaindsm.dll” is also available in my System32 directory.

    January 16, 2013 at 4:30 pm #25781 Reply
    spike
    Participant
    • Topics - 10
    • Replies - 139
    • Total Posts - 149

    About those message handlers, this is a managed .net C# application, so all those kind of stuff is normally handled by default.

    That’s not correct in the case of TWAIN, which requires that certain Windows messages be handled in a TWAIN-specific way.
    Neither Windows nor .NET will handle those messages correctly by default.

    But you said you can take your .exe, move it to Windows XP and run it, and it works and scans?
    That would mean it isn’t a message-handling problem.

    Well. You should have in your TWAIN-related code, someplace where you call TWAIN with pAppId, pSrcId, DG_CONTROL, DAT_EVENT, MSG_PROCESSEVENT, &event
    Or the equivalent in C#.
    If that call isn’t being made *somewhere* in your app while the scanner is enabled, then the dialog won’t work right.
    That call receives messages back from TWAIN in the event.TWMessage field, so there should be a switch or if after that, that looks for MSG_XFERREADY.
    If MSG_XFERREADY isn’t being handled, scanning will never start.

    Find that code and verify it. If necessary, breakpoint it to be sure it is being hit – the MSG_PROCESSEVENT call repeatedly while the scanner dialog is visible, and the MSG_XFERREADY code when you click the Scan button.

    If that call is nowhere in your code, see the TWAIN Spec, around 3-8: “How to Modify the Event Loop for Microsoft Windows” – and take a look at (for example) TwainDotNet.
    For example, you can see part of the message-processing stuff of TwainDotNet here:
    https://code.google.com/r/wsmwlh-twaindotnet/source/browse/TwainDotNet/DataSourceManager.cs?spec=svn9fdc61f462c2919dbad7717dbe1d736e6a5a5021&r=9fdc61f462c2919dbad7717dbe1d736e6a5a5021

  • Author
    Posts
Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: Twain Data Source in Windows 7
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

  • Sports betting Bonus Code
  • PDF/R For who and where?
  • Making searchable PDF with PDF/R
  • Backward compatibility with PDF/A and traditional PDF
  • could not open the twain source. Make sure there is a valid source for your sca
  • 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.