Resolved Scanner Twain and interrupts

ideprize

Well-known member
Joined
Oct 19, 2011
Messages
97
Programming Experience
10+
Hi to all
A vb.net program that I have developed and been updating for the past year incorporates a scanner twain from the vendor Dynamsoft. The software has worked without issues. Yesterday I encountered what I can only classify as "real time demands" by the Scanner Twain. I can no longer interrupt the image processing segment with msgbox. When I attempt to do so the msgbox is "sent" to the task bar and processing continues as though it was never incorporated in the build. I tried to create a call to a new form as a work around but this to resulted in the form also being "sent" to the task bar and ignored. Once the image processing is complete then any subsequent msgbox (and form call) in the code does behave as expected. I have tried a number of "fixes" to the msgbox itself such as specifying foreground mode and adding yes/no criteria all ending in the same "task bar dismissal". The most perplexing aspect of all, however, is that this behavior has just surfaced - it was not doing this a month ago. To be fair, however, that was billions and billions and billions of nanoseconds ago. Any insights from "the community" would be greatly appreciated.
Respectfully,
Ideprize
 
Sorry for the delay. Here is the code "segment" that is applicable:
VB.NET:
MsgBox("# of images = " + Trim(Str(imgc.ImageBuffer.HowManyImagesInBuffer)))

pgcnt = imgc.ImageBuffer.HowManyImagesInBuffer

MsgBox("pgcnt = " + Trim(Str(pgcnt)), vbMsgBoxSetForeground)

'all pages are now in the core image buffer
'one page TR, one TR

yrdir = Mid(trscnno, Len(trscnno) - 1, 2) + "\"
tempII.Add(imgc.ImageBuffer.CurrentImageIndexInBuffer)

MsgBox("image add to buffer action")

str1 = trdir + yrdir + trscnno + "1" + ".tif"
Label4.Text = "Saving " + str1
Label4.Refresh()
imgc.IO.SaveAsTIFF(str1, tempII)

MsgBox("image saveas event completed")

PictureBox1.ImageLocation = str1
PictureBox1.Load()
The msgbox at the start fires as expected. All subsequent msgbox commands are sent to the task and form a stack confirming the "halting action" of the msgbox is eliminated. Once the picturebox1.load() command is executed the next msgbox command halts execution but you must bring the "stack" to the foreground and click them off. Following this all msgbox commands behave as expected until this code is entered again. I intend to contact Dynamsoft for their analysis. This all started because I want to add an "interrupt" to prompt the user for confirmation on deleting an image (or not) before the "imgc.IO.SaveAsTIFF(str1,tempII)" command is executed if the image already exists. This "SaveAs" command deletes any such image without notification. I realize that I have to add a file.exist line of code prior to a "yes/no msgbox" in order to accomplish this and indeed my first attempt did include this and that is when I caught the anomaly - this is testing in the simplified form. To me the question is what sends a "msgbox" to the task in general and this is why I did not include the code originally.
Respectfully,
Ideprize
 
Last edited by a moderator:
I'm back. The problem was resolved. It had to do with an application.doevents function that I wrote which was executed above the code. It's obvious that I need to have a better understanding of that command. I was using it in conjunction with the picturebox image load process. The application.doevents command did eliminate the "mindcraft" printer output and of course exacted the price! Found a work around for the "mindcraft" problem as well. All in all as they say "my bad".
 
Back
Top