Loading...

fujitsu 5120: twain error ds42019

Support for GdTwain ActiveX and GdTwain Pro ActiveX/SDK.

fujitsu 5120: twain error ds42019

Postby ctn » Fri Dec 05, 2008 3:34 pm

Dear all

I got this twain error "ds42019" when I do a rescan after the the 1st scan has been crashed by any reason.
It seems that source could not be correctly closed and the application stops at the specific line which causes a crash.
No exception will be thrown and if I stop the application after a 2nd scan a windows pop up is going to be displayed with the twain error ds42019 (Message: Communication error. Scanner is either offline or not connected.)

Can somebody help me?
Thanks
Br,
Toan
ctn
 
Posts: 57
Joined: Thu Dec 04, 2008 6:20 pm

Re: fujitsu 5120: twain error ds42019

Postby ctn » Fri Dec 05, 2008 3:35 pm

Please find below additional logs:


#GdTwain Log Start. Version: 441

RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 3
-------------------
Start: OpenSource.
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 3
-------------------
Start: SetAutoFeed.
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS
-------------------
CAP_AUTOFEED. Result for Set False.
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 4
-------------------
End: SetAutoFeed.
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS
-------------------
Start: SetXferMech.
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS
-------------------
End: SetXferMech.
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS
-------------------
End: OpenSource.
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_SUCCESS
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS
-------------------
::DS operation. DG: DG_IMAGE - DAT: DAT_IMAGELAYOUT - MSG: MSG_GET ->RC: TWRC_SUCCESS
-------------------
::DS operation. DG: DG_IMAGE - DAT: DAT_IMAGELAYOUT - MSG: MSG_SET ->RC: TWRC_SUCCESS
-------------------
Start: AcquireNative.
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 4
Source: FUJITSU fi-5120Cdj
Manufacturer: FUJITSU
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_SUCCESS
-------------------
Start: WaitForXfer.
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_SUCCESS
-------------------
Start: SetXferMech.
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS
-------------------
End: SetXferMech.
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 4
-------------------
Start: EnableSource.
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_USERINTERFACE - MSG: MSG_ENABLEDS ->RC: TWRC_SUCCESS
-------------------
End: EnableSource.
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 5
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_DSEVENT CC: TWCC_SUCCESS
-------------------
MessageHook: MSG_XFERREADY.
RC: TWRC_DSEVENT
CC: TWCC_SUCCESS
State: 6
-------------------
Start: DoOneTransfer.
RC: TWRC_DSEVENT
CC: TWCC_SUCCESS
State: 6
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_SUCCESS
-------------------
Start: NativeXferHandler.
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 6
-------------------
::DS operation. DG: DG_IMAGE - DAT: DAT_IMAGENATIVEXFER - MSG: MSG_GET ->RC: TWRC_XFERDONE CC: TWCC_SUCCESS
-------------------
End: NativeXferHandler.
RC: TWRC_XFERDONE
CC: TWCC_SUCCESS
State: 7
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_FAILURE CC: TWCC_CAPUNSUPPORTED
-------------------
::DS operation. DG: DG_IMAGE - DAT: DAT_EXTIMAGEINFO - MSG: MSG_GET ->RC: TWRC_SUCCESS
-------------------
Start: EndXfer.
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 7
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_PENDINGXFERS - MSG: MSG_ENDXFER ->RC: TWRC_SUCCESS
-------------------
End: EndXfer.
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 5
-------------------
End: DoOneTransfer.
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 5
-------------------
End: ModalEventLoop.
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 5
-------------------
End: WaitForXfer.
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 5
-------------------
Start: DisableSource.
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 5
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_USERINTERFACE - MSG: MSG_DISABLEDS ->RC: TWRC_SUCCESS
-------------------
End: DisableSource.
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 4
-------------------
End: AcquireNative.
RC: TWRC_XFERDONE
CC: TWCC_SUCCESS
State: 4
-------------------
Start: CloseSource.
RC: TWRC_XFERDONE
CC: TWCC_SUCCESS
State: 4
-------------------
End: CloseSource.
RC: TWRC_FAILURE
CC: TWCC_BUMMER
State: 4
-------------------
Start: CloseSourceForce.
RC: TWRC_FAILURE
CC: TWCC_BUMMER
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_PENDINGXFERS - MSG: MSG_ENDXFER ->RC: TWRC_FAILURE CC: TWCC_BUMMER
-------------------
Result CloseSourceForce: DG_CONTROL - DAT_PENDINGXFERS - MSG_ENDXFER.
RC: TWRC_FAILURE
CC: TWCC_BUMMER
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_PENDINGXFERS - MSG: MSG_RESET ->RC: TWRC_FAILURE CC: TWCC_BUMMER
-------------------
Result CloseSourceForce: DG_CONTROL - DAT_PENDINGXFERS - MSG_RESET.
RC: TWRC_FAILURE
CC: TWCC_BUMMER
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_USERINTERFACE - MSG: MSG_DISABLEDS ->RC: TWRC_FAILURE CC: TWCC_BUMMER
-------------------
Result CloseSourceForce: DG_CONTROL - DAT_USERINTERFACE - MSG_DISABLEDS.
RC: TWRC_FAILURE
CC: TWCC_BUMMER
State: 4
-------------------
Result CloseSourceForce: DG_CONTROL - DAT_IDENTITY - MSG_CLOSEDS.
RC: TWRC_FAILURE
CC: TWCC_BUMMER
State: 4
-------------------
Result CloseSourceForce: DG_CONTROL - DAT_PARENT - MSG_CLOSEDSM.
RC: TWRC_FAILURE
CC: TWCC_BUMMER
State: 4
-------------------
End: CloseSourceForce.
RC: TWRC_FAILURE
CC: TWCC_BUMMER
State: 4
-------------------
Start: UnloadSourceManager.
RC: TWRC_FAILURE
CC: TWCC_BUMMER
State: 4
-------------------
End: UnloadSourceManager.
RC: TWRC_FAILURE
CC: TWCC_BUMMER
State: 4
-------------------
#GdTwain Log Stop.

#GdTwain Log Start. Version: 441

RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 3
-------------------
Start: OpenSource.
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 3
-------------------
End: OpenSource.
RC: TWRC_FAILURE
CC: TWCC_BUMMER
State: 3
-------------------
#GdTwain Log Stop.
ctn
 
Posts: 57
Joined: Thu Dec 04, 2008 6:20 pm

Re: fujitsu 5120: twain error ds42019

Postby Loïc » Fri Dec 05, 2008 4:19 pm

Hi,

You are right. The source seems to refuse to be closed.

Please following these steps:

- replace your gdtwain.dll file by this one: http://www.gdpicture.com/ressources/betas/gdtwain.dll
- execute the same code raising the previous error
- report again the log file
- Give me precisions on your environment (OS where the scanner is attached) & the code snippet you are using

Best regards,

Loïc
User avatar
Loïc
Site Admin
 
Posts: 5060
Joined: Tue Oct 17, 2006 10:48 pm
Location: France

Re: fujitsu 5120: twain error ds42019

Postby ctn » Mon Dec 08, 2008 2:32 pm

Hi,

My environment:
- Win xp
- C#.NET

I have installed your gdtwain.dll and got the following trace output:

#GdTwain Log Start. Version: 501

RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 1
-------------------
Start: OpenSource.
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 1
-------------------
Start: OpenSourceManager.
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 1
-------------------
DSM library loaded: C:\WINNT\TWAIN_32.DLL
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 1
-------------------
Entry point of the DSM found.
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 1
-------------------
End: OpenSourceManager.
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 3
-------------------
Start: SetAutoFeed.
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS
-------------------
CAP_AUTOFEED. Result for Set False.
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 4
-------------------
End: SetAutoFeed.
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS
-------------------
Start: SetXferMech.
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS
-------------------
End: SetXferMech.
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS
-------------------
End: OpenSource.
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_SUCCESS
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS
-------------------
::DS operation. DG: DG_IMAGE - DAT: DAT_IMAGELAYOUT - MSG: MSG_GET ->RC: TWRC_SUCCESS
-------------------
::DS operation. DG: DG_IMAGE - DAT: DAT_IMAGELAYOUT - MSG: MSG_SET ->RC: TWRC_SUCCESS
-------------------
Start: AcquireNative.
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 4
Source: FUJITSU fi-5120Cdj
Manufacturer: FUJITSU
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_SUCCESS
-------------------
Start: WaitForXfer.
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_SUCCESS
-------------------
Start: SetXferMech.
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS
-------------------
End: SetXferMech.
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 4
-------------------
Start: EnableSource.
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_USERINTERFACE - MSG: MSG_ENABLEDS ->RC: TWRC_SUCCESS
-------------------
End: EnableSource.
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 5
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_DSEVENT CC: TWCC_SUCCESS
-------------------
MessageHook: MSG_XFERREADY.
RC: TWRC_DSEVENT
CC: TWCC_SUCCESS
State: 6
-------------------
Start: DoOneTransfer.
RC: TWRC_DSEVENT
CC: TWCC_SUCCESS
State: 6
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_SUCCESS
-------------------
Start: NativeXferHandler.
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 6
-------------------
::DS operation. DG: DG_IMAGE - DAT: DAT_IMAGENATIVEXFER - MSG: MSG_GET ->RC: TWRC_XFERDONE CC: TWCC_SUCCESS
-------------------
End: NativeXferHandler.
RC: TWRC_XFERDONE
CC: TWCC_SUCCESS
State: 7
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_FAILURE CC: TWCC_CAPUNSUPPORTED
-------------------
::DS operation. DG: DG_IMAGE - DAT: DAT_EXTIMAGEINFO - MSG: MSG_GET ->RC: TWRC_SUCCESS
-------------------
Start: EndXfer.
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 7
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_PENDINGXFERS - MSG: MSG_ENDXFER ->RC: TWRC_SUCCESS
-------------------
End: EndXfer.
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 5
-------------------
End: DoOneTransfer.
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 5
-------------------
End: ModalEventLoop.
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 5
-------------------
End: WaitForXfer.
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 5
-------------------
Start: DisableSource.
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 5
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_USERINTERFACE - MSG: MSG_DISABLEDS ->RC: TWRC_SUCCESS
-------------------
End: DisableSource.
RC: TWRC_SUCCESS
CC: TWCC_SUCCESS
State: 4
-------------------
End: AcquireNative.
RC: TWRC_XFERDONE
CC: TWCC_SUCCESS
State: 4
-------------------
Start: CloseSource.
RC: TWRC_XFERDONE
CC: TWCC_SUCCESS
State: 4
-------------------
End: CloseSource.
RC: TWRC_FAILURE
CC: TWCC_BUMMER
State: 4
-------------------
Start: CloseSourceForce.
RC: TWRC_FAILURE
CC: TWCC_BUMMER
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_PENDINGXFERS - MSG: MSG_ENDXFER ->RC: TWRC_FAILURE CC: TWCC_BUMMER
-------------------
Result CloseSourceForce: DG_CONTROL - DAT_PENDINGXFERS - MSG_ENDXFER.
RC: TWRC_FAILURE
CC: TWCC_BUMMER
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_PENDINGXFERS - MSG: MSG_RESET ->RC: TWRC_FAILURE CC: TWCC_BUMMER
-------------------
Result CloseSourceForce: DG_CONTROL - DAT_PENDINGXFERS - MSG_RESET.
RC: TWRC_FAILURE
CC: TWCC_BUMMER
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_USERINTERFACE - MSG: MSG_DISABLEDS ->RC: TWRC_FAILURE CC: TWCC_BUMMER
-------------------
Result CloseSourceForce: DG_CONTROL - DAT_USERINTERFACE - MSG_DISABLEDS.
RC: TWRC_FAILURE
CC: TWCC_BUMMER
State: 4
-------------------
Result CloseSourceForce: DG_CONTROL - DAT_IDENTITY - MSG_CLOSEDS.
RC: TWRC_FAILURE
CC: TWCC_BUMMER
State: 4
-------------------
Result CloseSourceForce: DG_CONTROL - DAT_PARENT - MSG_CLOSEDSM.
RC: TWRC_FAILURE
CC: TWCC_BUMMER
State: 4
-------------------
End: CloseSourceForce.
RC: TWRC_FAILURE
CC: TWCC_BUMMER
State: 4
-------------------
Start: CloseSourceManager.
RC: TWRC_FAILURE
CC: TWCC_BUMMER
State: 4
-------------------
End: CloseSourceManager.
RC: TWRC_FAILURE
CC: TWCC_BUMMER
State: 4
-------------------
Start: UnloadSourceManager.
RC: TWRC_FAILURE
CC: TWCC_BUMMER
State: 4
-------------------
End: UnloadSourceManager.
RC: TWRC_FAILURE
CC: TWCC_BUMMER
State: 1
-------------------
#GdTwain Log Stop.

My code:

Code: Select all
      
                public void scanDocumentRegion()
      {
         gdTwainType = Type.GetTypeFromProgID(_gdTwainClassName);
         gdTwainObject = Activator.CreateInstance(gdTwainType);
         gdTwain = (Twain) gdTwainObject;
         gdTwain.SetLicenseNumber(License.DemoLicenseConstants.LICENSE_DEMO_GD_TWAIN);

         try
         {
            gdTwain.TwainSetHideUI(true);
            gdTwain.TwainLogStart(@"c:\gdTwain.log");

            if (gdTwain.TwainOpenSource(_sourceName))
            {
               Console.WriteLine("scanDocumentRegion(): Hide UI after --> {0}", gdTwain.TwainGetHideUI().ToString());
               TwainPaperSize paperSize = gdTwain.TwainGetPaperSize();
               gdTwain.TwainSetCurrentPixelType(TwainPixelType.TWPT_RGB);
               gdTwain.TwainSetPaperSize(paperSize);
               double nleft = 0;
               double nTop = 0;
               double nRight = 0;
               double nBottom = 0;

               if (gdTwain.TwainGetImageLayout(ref nleft, ref nTop, ref nRight, ref nBottom))
               {
                  Console.WriteLine("scanDocumentRegion(): Image layout --> left={0}, top={1}, right={2}, bottom={3}",
                                    nleft, nTop, nRight, nBottom);
                  nleft = nleft + 2;
                  nTop = nTop + 2;
                  nRight = nRight - 2;
                  nBottom = nBottom - 2;

                  gdTwain.TwainSetImageLayout(nleft, nTop, nRight, nBottom);
                  if (gdTwain.TwainIsAvailable())
                  {
                     if ((int) gdTwain.TwainGetState() >= 4)
                     {
                        gdTwain.TwainAcquireToGdPictureImage(0);

                        try
                        {
                           Array imageBytes = new byte[0];
                           int nBytesRead = imageBytes.Length;
                           gdTwain.SaveAsByteArray(ref imageBytes, ref nBytesRead, "usb", 0);

                           byte[] image = new byte[imageBytes.Length];

                           imageBytes.CopyTo(image, 0);

                           Console.WriteLine("Byte array: {0}", byteArrayConvertToString(image));
                        }
                        catch (Exception ex)
                        {
                           Console.WriteLine("scanDocumentRegion(): Exception --> {0}", ex.Message);
                        }
                     }
                  }
                  else
                  {
                     Console.WriteLine("scanDocumentRegion(): Scanner not available!");
                  }
               }
               else
               {
                  {
                     Console.WriteLine("scanDocumentRegion(): TwainGetLastResultCode() --> {0} ",
                                       gdTwain.TwainGetLastResultCode().ToString());
                     Console.WriteLine("scanDocumentRegion(): TwainGetLastConditionCode() --> {0} ",
                                       gdTwain.TwainGetLastConditionCode().ToString());
                  }
               }
            }
            else
            {
               Console.WriteLine("scanDocumentRegion(): Scanner not available --> source name={0}, scanner status={1}",
                                 gdTwain.TwainGetCurrentSourceName(), gdTwain.TwainGetState());
            }
            gdTwain.TwainLogStop();
         }
         catch (Exception ex)
         {
            Console.WriteLine("scanDocumentRegion(): Exception --> {0}", ex.Message);
         }
         finally
         {
            gdTwain.TwainCloseSource();
            gdTwain.TwainUnloadSourceManager();
            gdTwain.TwainCloseSourceManager(0);
         }
      }
      
      public string byteArrayConvertToString(byte[] byteArray)
      {
         string bitArray = "";
         for (int i = 0; i < byteArray.Length; i++)
         {
            bitArray += byteArray[i];
         }
         return bitArray;
      }


To reproduce the application crash I have closed the application before the scanning process has been finished since it needs time to convert the byte[] array to string (byteArrayConvertToString).

Thank you
Br,
ctn
ctn
 
Posts: 57
Joined: Thu Dec 04, 2008 6:20 pm

Re: fujitsu 5120: twain error ds42019

Postby Loïc » Mon Dec 08, 2008 2:55 pm

Hi,

Thanks for the code.

Regarding the log and your code I can't now find any problem.

Your code shows you are trying to acquire only one image, the log shows one image has been successfully acquired.

To reproduce the application crash I have closed the application before the scanning process has been finished since it needs time to convert the byte[] array to string (byteArrayConvertToString).


If you force the application to be closed during a scan process it can be possible that your TWAIN driver go away. With some scanners the only solution is to shut-down and replug.

A remark:

You shouldn't use null value for the window handle parameter in the following line:
Code: Select all
 gdTwain.TwainAcquireToGdPictureImage(0);


maybe you can replace it by:

Code: Select all
 gdTwain.TwainAcquireToGdPictureImage(this.Handle);




Best regards,

Loïc
User avatar
Loïc
Site Admin
 
Posts: 5060
Joined: Tue Oct 17, 2006 10:48 pm
Location: France

Re: fujitsu 5120: twain error ds42019

Postby ctn » Tue Dec 09, 2008 1:38 pm

Code: Select all
gdTwain.TwainAcquireToGdPictureImage(this.Handle);


"this.Handle" Does not work for me any other proposal?

Thank you
Br,
Toan
ctn
 
Posts: 57
Joined: Thu Dec 04, 2008 6:20 pm

Re: fujitsu 5120: twain error ds42019

Postby Loïc » Wed Dec 10, 2008 12:42 pm

Hi,

The goal is to give to the method a handle of the form controlling the scan process.
Each form has a HANDLE property which can be use to meet this need. I don't know where you put your code acquisition is written but you can find an easy way to pass the form HANDLE property as parameter of your function embedding your code.

Best regards,

Loïc
User avatar
Loïc
Site Admin
 
Posts: 5060
Joined: Tue Oct 17, 2006 10:48 pm
Location: France

Re: fujitsu 5120: twain error ds42019

Postby ctn » Wed Dec 10, 2008 6:15 pm

Hi Loïc

Since I m writing a console application, do I have a handle of a form?
Br,
Toan
ctn
 
Posts: 57
Joined: Thu Dec 04, 2008 6:20 pm

Re: fujitsu 5120: twain error ds42019

Postby Loïc » Wed Dec 10, 2008 8:37 pm

Since I m writing a console application, do I have a handle of a form?


OK !!! :D

I better understand your problem now. Unfortunately you can use handle. Just set 0 (like you already done).

Best regards,

Loïc
User avatar
Loïc
Site Admin
 
Posts: 5060
Joined: Tue Oct 17, 2006 10:48 pm
Location: France

Re: fujitsu 5120: twain error ds42019

Postby ctn » Thu Dec 11, 2008 2:52 pm

Ok. great!
Thank you for you answer.
Br,
ctn
ctn
 
Posts: 57
Joined: Thu Dec 04, 2008 6:20 pm


Return to GdTwain [Pro] ActiveX

Who is online

Users browsing this forum: No registered users and 1 guest