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

Using TWAIN from windows service application

Forums › TWAIN Classic › Using TWAIN from windows service application

  • This topic has 4 replies, 2 voices, and was last updated 13 years ago by gabe.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • January 6, 2008 at 3:43 pm #22267 Reply
    rob
    Participant
    • Topics - 1
    • Replies - 1
    • Total Posts - 2

    Hi All,

    I am a TWAIN newby, and i am trying to create the following :

    I am building a Windows Service Application which should be able acces the scanner. But since i have no UI Interface i can’t figure how to instruct TWAIN to do this.

    Is this possible ?

    January 6, 2008 at 11:22 pm #24244 Reply
    gabe
    Participant
    • Topics - 9
    • Replies - 583
    • Total Posts - 592

    Yes this is possible. It’s tricky depending on your programming language to get the messagepump to work correctly but after the pump is running it isn’t too much work. I have a vb.net windows service to make scanners available over the network. it listens/watches a network share for message files and based on the files performs a scan.
    In addition to the regular twain code you’ll have to work out some sort of dialog box management as a dialog box saying that the device is offline or that there has been a paperjam is a show stopper if the app is running as a service. From .net the dialog box manager was somewhat troublesome as it involved setting a cbthook and a shellhook. It didn’t initially seem that 2 different hooks would be required but some of the vendors don’t seem to… well some vendors are more creative than others.
    The remaining piece is a config Ui, in my case I have a standard form that sets up a profile and saves the parameters, the config Ui communicates with the service via a ipcServerCahnnel. That part was simple enough.
    The client side can be anything that is able to write the text files used for communication – in my case the client is a win32 app hosted by our main product.

    In general you’ll need to have a larger portion of the twain spec covered and implemented than if this were a desktop app as there won’t be much onscreen indication that something has gone wrong since the app will be running for all intents and purposes headless.

    All in all it was a pain to write but the payoff is that our main product running in citrix/terminal server session is able to acquire images from the machine that started the session.

    If you’re looking for help getting a project running, let me know what language you’re using and I try to help.

    .

    January 6, 2008 at 11:25 pm #24245 Reply
    gabe
    Participant
    • Topics - 9
    • Replies - 583
    • Total Posts - 592

    and read the spec end to end a least a couple times. I’m rather slow so it may not take you as long as it did me but I think by the 5th read the peices start to come together into a story (it’s a sad story with an unpleasant ending but at least it’s interesting)

    .

    January 7, 2008 at 8:34 am #24246 Reply
    rob
    Participant
    • Topics - 1
    • Replies - 1
    • Total Posts - 2

    Hi Gabe,

    Thanks for your reply. I am planning to build exactly the same functionality as you already did, i wanted to see if i could share my scanner over the network using TWAIN.

    I am using C# and the .NET framework 2.0, and currently am experimenting with this Twain.NET library :

    http://pksoft.hu/node/5

    I will continue reading the specs as you suggested.

    Regards

    Rob

    January 7, 2008 at 9:29 am #24247 Reply
    gabe
    Participant
    • Topics - 9
    • Replies - 583
    • Total Posts - 592

    my library is available at codeplex/opentwain. The sample projects I included are for winform and console project (the service project isn’t avaiable) same library can be used from within a service as it provides it’s own pump. A good deal of the dailog mangement is available there as well.

    if you need help just ask.

    .

  • Author
    Posts
Viewing 5 posts - 1 through 5 (of 5 total)
Reply To: Reply #24245 in Using TWAIN from windows service application
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

  • New project started to be available today, check it out
  • 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.
  • 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.