Cancel a twain scan programmatically
Posted: Wed Mar 09, 2016 8:20 am
Hi.
I am evaluating the gdpicture.net. I came across this issue, I whould appreciate help.
I scan on a program that is need to be reset to its starting point after a certain time that there was no activity on the form. (It's a kiosk app so if a user left in middle of a session, we need to programmatically cancel out the unfinished work, so the next user can start from begging).
Now I call the TwainAcquireToGdPictureImage, it all work great but I try to have a timer that calls TwainCloseSource if let's say 60 secunds pessed by and the user have not scanned (the code waits for the return of TwainAcquireToGdPictureImag), when the closecource is called my program crashes if the twain is still waiting, (simply creshing, I cannot handle the error with try catch, as the bug is in the gdpicture.net clr).
I can call closecource only when the TwainAcquireToGdPictureImage is finish, but not when it's still running.
I use vfp and gdpicture as com, I can confirm that the gdpicture.net is crashing as I don't get any errors in vfp, I just see the .net clr.dll crash in event viewer.
I need a way of cancelling an initiated twain acquire without user input.
This is also important for other reason, as I hide the scanner ui, sometimes the ui just waits for user input and the user has not way of doing it as its hidden. But if I whould be able to cancel out the scan with a timer then this whould be solved as well for my needs.
Thank you
Please help
Edit
Calling twaindisablesource did work. For me, but still crashes when call afterwards closecource
I am evaluating the gdpicture.net. I came across this issue, I whould appreciate help.
I scan on a program that is need to be reset to its starting point after a certain time that there was no activity on the form. (It's a kiosk app so if a user left in middle of a session, we need to programmatically cancel out the unfinished work, so the next user can start from begging).
Now I call the TwainAcquireToGdPictureImage, it all work great but I try to have a timer that calls TwainCloseSource if let's say 60 secunds pessed by and the user have not scanned (the code waits for the return of TwainAcquireToGdPictureImag), when the closecource is called my program crashes if the twain is still waiting, (simply creshing, I cannot handle the error with try catch, as the bug is in the gdpicture.net clr).
I can call closecource only when the TwainAcquireToGdPictureImage is finish, but not when it's still running.
I use vfp and gdpicture as com, I can confirm that the gdpicture.net is crashing as I don't get any errors in vfp, I just see the .net clr.dll crash in event viewer.
I need a way of cancelling an initiated twain acquire without user input.
This is also important for other reason, as I hide the scanner ui, sometimes the ui just waits for user input and the user has not way of doing it as its hidden. But if I whould be able to cancel out the scan with a timer then this whould be solved as well for my needs.
Thank you
Please help
Edit
Calling twaindisablesource did work. For me, but still crashes when call afterwards closecource