Transfer images real time?

Jun 29, 2010 at 12:12 AM

gaccettola,

I can see that the transfer ready event is firing only after the ADF is empty...  Is there a method to transfer the images as they are scanned?  Am I missing it?  What I'd like is a document or image finished event with event arguments that would point to the image as a drawing.bitmap, or drawing.image, so that I could handle images in memory as they are scanned.  I could probably build it, but I dont want to repeat work if the method is already there.

Thanks again for this project, and your help.

fhbiii

Coordinator
Jul 7, 2010 at 7:39 AM
there isn't currently an event for each image as it is acquired, but it shouldn't be tricky to implement. If I remember correctly their ought to be a 'DoEndXfer' method in ctwain.vb that is getting called on the completion of each image. you might have to change the signature of the function so you can pass the filename that was just acquired to you can forward it in the event but it shouldn't be too tricky. Let me know if you need help adding that, .
Jul 7, 2010 at 11:33 AM

Gabe!  I thought you were dead man.  I've played with it a little.  My goal is to transfer straight into an system.drawing.image object from the hbitmap.  I believe I've been able to accomplish this, but the event is not firing as I would expect.  I think I need to add a listener for the event in the main application, and/or have the event fire on separate threads.  Any thoughts?

Fred (fhbiii)

Coordinator
Jul 12, 2010 at 11:08 AM

not dead yet, just buried under a pile of native code apps for work.  I'd complain if i didn't like it.

two mains paths i see here, you post your project and I step through it or i take the last release and add what i think is needed, your pick.

 

.

Jul 12, 2010 at 11:53 AM
Well, as my code is a wreck at the moment, I'll take the option where you add what is needed to the latest official release.

Glad you are still alive, and keeping busy.

Fred (fhbiii)
Jan 18, 2011 at 5:56 PM

Gabe,  Any luck on this?  Have not heard anything in a while.

Fred

Coordinator
Jan 20, 2011 at 3:51 PM

the option where I add what it needed to the last release has seen little movement.

sorry

Coordinator
Jan 20, 2011 at 7:57 PM

you caught me curious in a time or no active overdue project.  there is a little work to make this happen, not a lot.

here are the general steps to update the guiharness sample.

there is an event built-in right now, TransferReadyEvent.  In the guiSample it is handled around line 1312 in Manager.vb and called when all the files are done (but you could call this with each file) from cTwain.vb on line 1283.  Basically you're just going to raise the when each image is done instead of when all of the images are done.

Two updates.  One in TransferPicturesAsNative and another in TransferPicturesAsFile.

In the TransferPicturesAsNative method under Case Enumerations.ReturnCode.XferDone you'll see line 996 where we convert the native image and save the file with Plumbing.DibToBmp.DibHandToBmp(hbitmap).Save(fileName).  At that point the image is on disk and in the samples I add the path to _Images.  

Then do something really really similar TransferPicturesAsFile around line 1110 you'll see _Images.Add(SetupFile.FileName) and at that point you can raise TransferReadyEvent.

That should handle the majority of what needs to be done.  Ask if this doesn't work or if you have more|other questions.

gabe

 

 

Jan 21, 2011 at 2:30 PM

Thanks Gabe I'll look into it when I get a chance.

Fred