TWAIN threading issue

Discussions about TWAIN & WIA scanning in GdPicture.NET using GdPictureImaging.
dixus
Posts: 39
Joined: Wed Feb 10, 2010 9:23 am

TWAIN threading issue

Post by dixus » Wed Feb 17, 2010 4:20 pm

Hello,

i successfully used TwainAcquireToGdPictureImage to get a TIF from my TWAIN device. (currently a webcam - will be replaced by a scanner later)

Now i tried to run this whole stuff in a worker thread. It works exactely for one time. If i try to get a picture from my webcam again, TwainAcquireToGdPictureImage return 0 and it hangs at TwainUnloadSourceManager



Here is the core of the TWAIN acquire... Not that magical but i have no idea why the second scan doesnt work...

Code: Select all

if (!GdLib.TwainOpenDefaultSource(IntPtr.Zero))
    return false;

int ImageID = GdLib.TwainAcquireToGdPictureImage(IntPtr.Zero); //returning 0 at second run
if (ImageID != 0)
{
    GdLib.SaveAsTIFF(ImageID, path, (TiffCompression)ScanServiceCompression.TiffCompressionLZW);
    GdLib.ReleaseGdPictureImage(ImageID);
}
GdLib.TwainCloseSource();
GdLib.TwainUnloadSourceManager(IntPtr.Zero); //hangs at second run
The second question... I tried to disable the TWAIN UI but that method has no effect...
GdLib.TwainSetHideUI(true);

Is is possible to hide the TWAIN UI and to get an image automatically from the default twain source?

best regards
dix

dixus
Posts: 39
Joined: Wed Feb 10, 2010 9:23 am

Re: TWAIN threading issue

Post by dixus » Thu Feb 18, 2010 11:13 am

I am testing now with a scanner (espson perfection 2480) and i have the same issue. The second scan doesnt work.

The twain logfile is flooded with following mesasge:

::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS

i hope you can help me because we wanna buy the full lib if we get this working.

Is there anything else to think about using gdpicture in worker threads? l

Tyvm

Code: Select all


#GdTwain Log Start. Version: 634

RC:   TWRC_FAILURE
CC:   TWCC_BADCAP
State: 4
-------------------
Start: LoadCapValuesN.
RC:   TWRC_FAILURE
CC:   TWCC_BADCAP
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_FAILURE CC: TWCC_BADCAP
-------------------
End: LoadCapValuesN.
RC:   TWRC_FAILURE
CC:   TWCC_BADCAP
State: 4
-------------------
Start: LoadCapValuesN.
RC:   TWRC_FAILURE
CC:   TWCC_BADCAP
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_FAILURE CC: TWCC_BADCAP
-------------------
End: LoadCapValuesN.
RC:   TWRC_FAILURE
CC:   TWCC_BADCAP
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_FAILURE CC: TWCC_BADCAP
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_FAILURE CC: TWCC_BADCAP
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_FAILURE CC: TWCC_BADCAP
-------------------
::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_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_FAILURE CC: TWCC_BADVALUE
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS
-------------------
Start: AcquireNative.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
Source: EPSON Perfection 2480/2580
Manufacturer: EPSON
-------------------
AcquireNative: Retrieving current device configuration - Start.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_FAILURE CC: TWCC_BADCAP
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_FAILURE CC: TWCC_BADCAP
-------------------
AcquireNative: Retrieving current device configuration - End.
RC:   TWRC_FAILURE
CC:   TWCC_BADCAP
State: 4
-------------------
::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
-------------------
Start: EndXfer.
RC:   TWRC_XFERDONE
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
-------------------
AcquireNative: One transfer mode -> disabling source.
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
Source: EPSON Perfection 2480/2580
Manufacturer: EPSON
-------------------
End: CloseSource.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 3
-------------------
Start: CloseSourceManager.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 3
-------------------
End: CloseSourceManager.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 2
-------------------
Start: OpenSourceManager.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 2
-------------------
End: OpenSourceManager.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 3
-------------------
Start: OpenDefaultSource.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 3
-------------------
::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
-------------------
End: OpenDefaultSource.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
-------------------
Start: LoadCapValuesN.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_SUCCESS
-------------------
End: LoadCapValuesN.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
-------------------
Start: LoadCapValuesN.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_FAILURE CC: TWCC_BADCAP
-------------------
End: LoadCapValuesN.
RC:   TWRC_FAILURE
CC:   TWCC_BADCAP
State: 4
-------------------
Start: LoadCapValuesN.
RC:   TWRC_FAILURE
CC:   TWCC_BADCAP
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_FAILURE CC: TWCC_BADCAP
-------------------
End: LoadCapValuesN.
RC:   TWRC_FAILURE
CC:   TWCC_BADCAP
State: 4
-------------------
Start: LoadCapValuesN.
RC:   TWRC_FAILURE
CC:   TWCC_BADCAP
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_FAILURE CC: TWCC_BADCAP
-------------------
End: LoadCapValuesN.
RC:   TWRC_FAILURE
CC:   TWCC_BADCAP
State: 4
-------------------
Start: LoadCapValuesN.
RC:   TWRC_FAILURE
CC:   TWCC_BADCAP
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_FAILURE CC: TWCC_BADCAP
-------------------
End: LoadCapValuesN.
RC:   TWRC_FAILURE
CC:   TWCC_BADCAP
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_FAILURE CC: TWCC_BADCAP
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_FAILURE CC: TWCC_BADCAP
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_FAILURE CC: TWCC_BADCAP
-------------------
::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_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_FAILURE CC: TWCC_BADVALUE
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS
-------------------
Start: AcquireNative.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
Source: EPSON Perfection 2480/2580
Manufacturer: EPSON
-------------------
AcquireNative: Retrieving current device configuration - Start.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_FAILURE CC: TWCC_BADCAP
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_FAILURE CC: TWCC_BADCAP
-------------------
AcquireNative: Retrieving current device configuration - End.
RC:   TWRC_FAILURE
CC:   TWCC_BADCAP
State: 4
-------------------
::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
-------------------
GetValidHwnd: Invalid window handle.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
-------------------
GetValidHwnd: Invalid window handle.
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_NOTDSEVENT CC: TWCC_SUCCESS
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS
...


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

Re: TWAIN threading issue

Post by Loïc » Thu Feb 18, 2010 12:02 pm

Hi,

Please try this version of gdtwain.dll: http://www.gdpicture.com/download/beta/gdtwain.dll

Then, report the new generated log for investigation.

With best regards,

Loïc

dixus
Posts: 39
Joined: Wed Feb 10, 2010 9:23 am

Re: TWAIN threading issue

Post by dixus » Thu Feb 18, 2010 12:21 pm

Wow thanks! That dll works!!

So what was the issue? I Should i use a beta version or will this be fixed in the next release?

Here is the produced log if you need it. I was able to scan three files now :)

Code: Select all


#GdTwain Log Start. Version: 640

RC:   TWRC_FAILURE
CC:   TWCC_BADCAP
State: 4
-------------------
Start: LoadCapValuesN.
RC:   TWRC_FAILURE
CC:   TWCC_BADCAP
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_FAILURE CC: TWCC_BADCAP // TWmsg: 0
-------------------
End: LoadCapValuesN.
RC:   TWRC_FAILURE
CC:   TWCC_BADCAP
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_FAILURE CC: TWCC_BADCAP // TWmsg: dc
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_FAILURE CC: TWCC_BADCAP // TWmsg: dc
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_FAILURE CC: TWCC_BADCAP // TWmsg: dc
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS // TWmsg: dc
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS // TWmsg: dc
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS // TWmsg: dc
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_FAILURE CC: TWCC_BADVALUE // TWmsg: dc
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS // TWmsg: dc
-------------------
Start: AcquireNative.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
Source: EPSON Perfection 2480/2580
Manufacturer: EPSON
-------------------
AcquireNative: Retrieving current device configuration - Start.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_FAILURE CC: TWCC_BADCAP // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_FAILURE CC: TWCC_BADCAP // TWmsg: 0
-------------------
AcquireNative: Retrieving current device configuration - End.
RC:   TWRC_FAILURE
CC:   TWCC_BADCAP
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_SUCCESS // TWmsg: dc
-------------------
Start: WaitForXfer.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_SUCCESS // TWmsg: dc
-------------------
Start: SetXferMech.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS // TWmsg: dc
-------------------
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 // TWmsg: a3c
-------------------
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 // TWmsg: 101
-------------------
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 // TWmsg: dc
-------------------
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 // TWmsg: 661b
-------------------
End: NativeXferHandler.
RC:   TWRC_XFERDONE
CC:   TWCC_SUCCESS
State: 7
-------------------
Start: EndXfer.
RC:   TWRC_XFERDONE
CC:   TWCC_SUCCESS
State: 7
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_PENDINGXFERS - MSG: MSG_ENDXFER ->RC: TWRC_SUCCESS // TWmsg: 0
-------------------
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
-------------------
AcquireNative: One transfer mode -> disabling source.
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 // TWmsg: a3c
-------------------
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
Source: EPSON Perfection 2480/2580
Manufacturer: EPSON
-------------------
End: CloseSource.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 3
-------------------
Start: CloseSourceManager.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 3
-------------------
End: CloseSourceManager.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 2
-------------------
Window Proxy Destroyed !
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 2
-------------------
GetValidHwnd: Creating Proxy window.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 2
-------------------
Start: OpenSourceManager.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 2
-------------------
End: OpenSourceManager.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 3
-------------------
Start: OpenDefaultSource.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 3
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS // TWmsg: dc
-------------------
Start: SetXferMech.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS // TWmsg: dc
-------------------
End: SetXferMech.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
-------------------
End: OpenDefaultSource.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
-------------------
Start: LoadCapValuesN.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_SUCCESS // TWmsg: dc
-------------------
End: LoadCapValuesN.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
-------------------
Start: LoadCapValuesN.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_FAILURE CC: TWCC_BADCAP // TWmsg: 0
-------------------
End: LoadCapValuesN.
RC:   TWRC_FAILURE
CC:   TWCC_BADCAP
State: 4
-------------------
Start: LoadCapValuesN.
RC:   TWRC_FAILURE
CC:   TWCC_BADCAP
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_FAILURE CC: TWCC_BADCAP // TWmsg: 0
-------------------
End: LoadCapValuesN.
RC:   TWRC_FAILURE
CC:   TWCC_BADCAP
State: 4
-------------------
Start: LoadCapValuesN.
RC:   TWRC_FAILURE
CC:   TWCC_BADCAP
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_FAILURE CC: TWCC_BADCAP // TWmsg: 0
-------------------
End: LoadCapValuesN.
RC:   TWRC_FAILURE
CC:   TWCC_BADCAP
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_FAILURE CC: TWCC_BADCAP // TWmsg: dc
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_FAILURE CC: TWCC_BADCAP // TWmsg: dc
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_FAILURE CC: TWCC_BADCAP // TWmsg: dc
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS // TWmsg: dc
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS // TWmsg: dc
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS // TWmsg: dc
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_FAILURE CC: TWCC_BADVALUE // TWmsg: dc
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS // TWmsg: dc
-------------------
Start: AcquireNative.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
Source: EPSON Perfection 2480/2580
Manufacturer: EPSON
-------------------
AcquireNative: Retrieving current device configuration - Start.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_FAILURE CC: TWCC_BADCAP // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_FAILURE CC: TWCC_BADCAP // TWmsg: 0
-------------------
AcquireNative: Retrieving current device configuration - End.
RC:   TWRC_FAILURE
CC:   TWCC_BADCAP
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_SUCCESS // TWmsg: dc
-------------------
Start: WaitForXfer.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_SUCCESS // TWmsg: dc
-------------------
Start: SetXferMech.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS // TWmsg: dc
-------------------
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 // TWmsg: a68
-------------------
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 // TWmsg: 101
-------------------
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 // TWmsg: dc
-------------------
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 // TWmsg: 661b
-------------------
End: NativeXferHandler.
RC:   TWRC_XFERDONE
CC:   TWCC_SUCCESS
State: 7
-------------------
Start: EndXfer.
RC:   TWRC_XFERDONE
CC:   TWCC_SUCCESS
State: 7
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_PENDINGXFERS - MSG: MSG_ENDXFER ->RC: TWRC_SUCCESS // TWmsg: 0
-------------------
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
-------------------
AcquireNative: One transfer mode -> disabling source.
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 // TWmsg: a68
-------------------
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
Source: EPSON Perfection 2480/2580
Manufacturer: EPSON
-------------------
End: CloseSource.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 3
-------------------
Start: CloseSourceManager.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 3
-------------------
End: CloseSourceManager.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 2
-------------------
Window Proxy Destroyed !
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 2
-------------------
GetValidHwnd: Creating Proxy window.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 2
-------------------
Start: OpenSourceManager.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 2
-------------------
End: OpenSourceManager.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 3
-------------------
Start: OpenDefaultSource.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 3
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS // TWmsg: dc
-------------------
Start: SetXferMech.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS // TWmsg: dc
-------------------
End: SetXferMech.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
-------------------
End: OpenDefaultSource.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
-------------------
Start: LoadCapValuesN.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_SUCCESS // TWmsg: dc
-------------------
End: LoadCapValuesN.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
-------------------
Start: LoadCapValuesN.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_FAILURE CC: TWCC_BADCAP // TWmsg: 0
-------------------
End: LoadCapValuesN.
RC:   TWRC_FAILURE
CC:   TWCC_BADCAP
State: 4
-------------------
Start: LoadCapValuesN.
RC:   TWRC_FAILURE
CC:   TWCC_BADCAP
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_FAILURE CC: TWCC_BADCAP // TWmsg: 0
-------------------
End: LoadCapValuesN.
RC:   TWRC_FAILURE
CC:   TWCC_BADCAP
State: 4
-------------------
Start: LoadCapValuesN.
RC:   TWRC_FAILURE
CC:   TWCC_BADCAP
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_FAILURE CC: TWCC_BADCAP // TWmsg: 0
-------------------
End: LoadCapValuesN.
RC:   TWRC_FAILURE
CC:   TWCC_BADCAP
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_FAILURE CC: TWCC_BADCAP // TWmsg: dc
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_FAILURE CC: TWCC_BADCAP // TWmsg: dc
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_FAILURE CC: TWCC_BADCAP // TWmsg: dc
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS // TWmsg: dc
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS // TWmsg: dc
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS // TWmsg: dc
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_FAILURE CC: TWCC_BADVALUE // TWmsg: dc
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS // TWmsg: dc
-------------------
Start: AcquireNative.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
Source: EPSON Perfection 2480/2580
Manufacturer: EPSON
-------------------
AcquireNative: Retrieving current device configuration - Start.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_FAILURE CC: TWCC_BADCAP // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_FAILURE CC: TWCC_BADCAP // TWmsg: 0
-------------------
AcquireNative: Retrieving current device configuration - End.
RC:   TWRC_FAILURE
CC:   TWCC_BADCAP
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_SUCCESS // TWmsg: dc
-------------------
Start: WaitForXfer.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_SUCCESS // TWmsg: dc
-------------------
Start: SetXferMech.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS // TWmsg: dc
-------------------
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 // TWmsg: a68
-------------------
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 // TWmsg: 101
-------------------
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 // TWmsg: dc
-------------------
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 // TWmsg: 661b
-------------------
End: NativeXferHandler.
RC:   TWRC_XFERDONE
CC:   TWCC_SUCCESS
State: 7
-------------------
Start: EndXfer.
RC:   TWRC_XFERDONE
CC:   TWCC_SUCCESS
State: 7
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_PENDINGXFERS - MSG: MSG_ENDXFER ->RC: TWRC_SUCCESS // TWmsg: 0
-------------------
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
-------------------
AcquireNative: One transfer mode -> disabling source.
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 // TWmsg: a68
-------------------
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
Source: EPSON Perfection 2480/2580
Manufacturer: EPSON
-------------------
End: CloseSource.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 3
-------------------
Start: CloseSourceManager.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 3
-------------------
End: CloseSourceManager.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 2
-------------------
Window Proxy Destroyed !
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 2
-------------------
Start: UnloadSourceManager.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 2
-------------------
End: UnloadSourceManager.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 1
-------------------
#GdTwain Log Stop.

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

Re: TWAIN threading issue

Post by Loïc » Thu Feb 18, 2010 12:25 pm

:mrgreen:

This was a knows bug (very hard to solve - 2 weeks of investigation).

You can consider this dll as stable, it is our dll for the next release.

Kind regards,

Loïc

dixus
Posts: 39
Joined: Wed Feb 10, 2010 9:23 am

Re: TWAIN threading issue

Post by dixus » Thu Feb 18, 2010 12:33 pm

uhg... Great work and thanks again!

monster

dixus
Posts: 39
Joined: Wed Feb 10, 2010 9:23 am

Re: TWAIN threading issue

Post by dixus » Mon Feb 22, 2010 2:27 pm

Hi loic,

i dont know if happens because its monday... But in my project the gdtwain doesnt work anymore. I cant imagine why. I checked out an earlier version of the project. There is NO difference at all between the TWAIN code. The old project works, my current code doesnt.

My issue above was that the second scan didnt start. My current issue is, that no scan starts :-(

Code: Select all


#GdTwain Log Start. Version: 634

RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_FAILURE CC: TWCC_BADCAP
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_FAILURE CC: TWCC_BADCAP
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_FAILURE CC: TWCC_BADCAP
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_FAILURE CC: TWCC_BADCAP
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_FAILURE CC: TWCC_BADCAP
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_FAILURE CC: TWCC_BADCAP
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_FAILURE CC: TWCC_BADCAP
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_FAILURE CC: TWCC_BADCAP
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_FAILURE CC: TWCC_BADCAP
-------------------
::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_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_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS
-------------------
Start: AcquireNative.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
Source: EPSON Perfection 2480/2580
Manufacturer: EPSON
-------------------
AcquireNative: Retrieving current device configuration - Start.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_FAILURE CC: TWCC_BADCAP
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_FAILURE CC: TWCC_BADCAP
-------------------
AcquireNative: Retrieving current device configuration - End.
RC:   TWRC_FAILURE
CC:   TWCC_BADCAP
State: 4
-------------------
::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_NOTDSEVENT CC: TWCC_SUCCESS
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS
-------------------

I made sure that the new twain.dll is in my project. Probably you have an idea wth this is caused by.
I copied and pasted the working code snippeds in the current project files. There is no difference but it doesnt work there.

:shock:

the core code of my twain service looks like that...

Code: Select all

private bool OpenTwainDevice(string DeviceName)
{
    if (!GdLib.TwainIsAvailable())
        return false;
    if (!string.IsNullOrEmpty(DeviceName))
    {
        if (!GdLib.TwainOpenSource(IntPtr.Zero, DeviceName))
            return false;
    }
    else if (!GdLib.TwainOpenDefaultSource(IntPtr.Zero))
        return false;

    if (!GdLib.TwainIsDeviceOnline())
        return false;
    return true;

}

protected override bool PreProcess()
{
    _handler.RaiseProcessedEvent("Init Scanner...");

    if (!OpenTwainDevice(Config.Source))
        return false;

    GdLib.TwainLogStart("d:\\twainlog.txt");

    GdLib.TwainSetAutomaticBorderDetection(true);
    GdLib.TwainSetBitDepthReduction(TwainBitDepthReduction.TWBR_DIFFUSION);
    GdLib.TwainSetAutoSize(true);
    GdLib.TwainSetAutoBrightness(true);
    GdLib.TwainSetAutomaticDeskew(true);
    GdLib.TwainSetContrast(200);
    GdLib.TwainSetResolution(300);
    GdLib.TwainSetPixelType(TwainPixelType.TWPT_GRAY);
    GdLib.TwainSetHideUI(true);
    GdLib.TwainSetModalUI(false);
    GdLib.TwainSetIndicators(true);
    GdLib.TwainSetAutoSourceClose(false);
    
    return true;
}


protected override void ExecuteService()
{
    _handler.RaiseProcessedEvent("Scanning...");

    int ImageID = GdLib.TwainAcquireToGdPictureImage(IntPtr.Zero);
    if (ImageID != 0)
    {
        string filename = SIServiceHelper.GetNextScanFilename(Config.RepositoryPath);
        _handler.RaiseProcessedEvent(string.Format("Saving {0}...", filename));

        GdLib.SaveAsTIFF(ImageID, filename, (TiffCompression)ScanServiceCompression.TiffCompressionLZW);
        GdLib.ReleaseGdPictureImage(ImageID);
    }
    GdLib.TwainCloseSourceManager(IntPtr.Zero);
    GdLib.TwainCloseSource();

}
greetings
dix

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

Re: TWAIN threading issue

Post by Loïc » Mon Feb 22, 2010 2:39 pm

Hi Dix,

Don't worry, you are using old version of gdtwain.dll:

Code: Select all

#GdTwain Log Start. Version: 634
I can suggest you to make a search of gdtwain.dll on your system. Remove of files found and copy the version I gave you into system32 directory.

With best regards,

Loïc

dixus
Posts: 39
Joined: Wed Feb 10, 2010 9:23 am

Re: TWAIN threading issue

Post by dixus » Mon Feb 22, 2010 2:54 pm

omg! i was checking the wrong folder. lol
ty!

dixus
Posts: 39
Joined: Wed Feb 10, 2010 9:23 am

Re: TWAIN threading issue

Post by dixus » Mon Feb 22, 2010 4:20 pm

hello again,

i finally got the multipage scanner for testing. fujitsu fi-6140..

I have some trouble to get it running with gdpicture. I could scan a page via paint... But with gdpicture its the same behavior like described above with the old twain.dll.
This time i used the correct dll :wink:

I dont get any error message.. it just looks like it hangs in a message loop or something like that..

Thanks for your help.

dix

Code: Select all


#GdTwain Log Start. Version: 640

RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS // TWmsg: fc
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS // TWmsg: fc
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_SUCCESS // TWmsg: fc
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS // TWmsg: fc
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_FAILURE CC: TWCC_CAPUNSUPPORTED // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_FAILURE CC: TWCC_CAPUNSUPPORTED // TWmsg: fc
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_FAILURE CC: TWCC_CAPUNSUPPORTED // TWmsg: fc
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS // TWmsg: fc
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_FAILURE CC: TWCC_CAPUNSUPPORTED // TWmsg: fc
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_CHECKSTATUS CC: TWCC_BADVALUE // TWmsg: fc
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_SUCCESS // TWmsg: fc
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_CHECKSTATUS CC: TWCC_BADVALUE // TWmsg: fc
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS // TWmsg: fc
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS // TWmsg: fc
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS // TWmsg: fc
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_FAILURE CC: TWCC_CAPSEQERROR // TWmsg: fc
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS // TWmsg: fc
-------------------
Start: AcquireNative.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
Source: FUJITSU fi-6140dj
Manufacturer: FUJITSU
-------------------
AcquireNative: Retrieving current device configuration - Start.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_SUCCESS // TWmsg: fc
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_SUCCESS // TWmsg: fc
-------------------
AcquireNative: Retrieving current device configuration - End.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_SUCCESS // TWmsg: fc
-------------------
Start: WaitForXfer.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_SUCCESS // TWmsg: fc
-------------------
Start: SetXferMech.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS // TWmsg: fc
-------------------
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 // TWmsg: a08
-------------------
End: EnableSource.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 5
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_DSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_DSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_DSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_DSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_DSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_DSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_DSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_DSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_DSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_DSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_DSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_DSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------

dixus
Posts: 39
Joined: Wed Feb 10, 2010 9:23 am

Re: TWAIN threading issue

Post by dixus » Mon Feb 22, 2010 4:57 pm

when i set TwainSetHideUI to false the UI of the TWAIN driver pops up.

But after I have clicked on "SCAN" its the same issue..

It hangs. If i try the same code in a single thread project it works :/

Code: Select all


#GdTwain Log Start. Version: 640

RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
-------------------
Start: AcquireNative.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
Source: FUJITSU fi-6140dj
Manufacturer: FUJITSU
-------------------
AcquireNative: Retrieving current device configuration - Start.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_SUCCESS // TWmsg: fc
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_SUCCESS // TWmsg: fc
-------------------
AcquireNative: Retrieving current device configuration - End.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_SUCCESS // TWmsg: fc
-------------------
Start: WaitForXfer.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_GETCURRENT ->RC: TWRC_SUCCESS // TWmsg: fc
-------------------
Start: SetXferMech.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 4
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_CAPABILITY - MSG: MSG_SET ->RC: TWRC_SUCCESS // TWmsg: fc
-------------------
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 // TWmsg: a24
-------------------
End: EnableSource.
RC:   TWRC_SUCCESS
CC:   TWCC_SUCCESS
State: 5
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_DSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_DSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_DSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_DSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_DSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_DSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_DSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_DSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------
::DS operation. DG: DG_CONTROL - DAT: DAT_EVENT - MSG: MSG_PROCESSEVENT ->RC: TWRC_NOTDSEVENT CC: TWCC_SUCCESS // TWmsg: 0
-------------------
...


dixus
Posts: 39
Joined: Wed Feb 10, 2010 9:23 am

Re: TWAIN threading issue

Post by dixus » Mon Feb 22, 2010 5:15 pm

FYI. I just ran the TWAIN example in a workerthread and this works. :/ This is really weird.
I copy & and pasted the workerthread in my project that doesnt work... same issue. it hangs up. :?

dixus
Posts: 39
Joined: Wed Feb 10, 2010 9:23 am

Re: TWAIN threading issue

Post by dixus » Mon Feb 22, 2010 6:51 pm

hello again,


this makes me crazy. I hope you have an idea after reading the following hints

- i replaced the old twain.dll on my pc (file search!)
- if i clean up my project folder the OLD twain.dll is copied to my debug folder ( i have no clue where it comes from)
(thats why the old version number was back!!)

I only have the GdPicture.NET.dll referenced in my project. The other dlls are copied from somewhere else to that directory when i start the project for the first time.

Now the question... Does GdPicture.NET.dll auto generate those dlls if they arent there??? I cant explain where the old twain version is copied from.

Second question: When i manually copy the twain.dll in my debug folder... the TWAIN LOG shows 640... but can it be that the old version is loaded and only the wrong version number is shown?

cheers
dix

dixus
Posts: 39
Joined: Wed Feb 10, 2010 9:23 am

Re: TWAIN threading issue

Post by dixus » Mon Feb 22, 2010 8:26 pm

uhhh. after 5 hours of debugging and comparing sources i found the reason. It has nothing to do with the twain.dlls version problem described above...

monster

In my Form that starts the scan thread i added code like this

Code: Select all

...GdLib.TwainGetDefaultSourceName(IntPtr.Zero);
...GdLib.TwainGetCurrentSourceName(IntPtr.Zero);
This is the reason why the scan in the worker thread runs in that message loop! I uncommented this and it works...

Is this a bug? Or my fault? I tried gdlib.ClearGdPicture() after i read the twaindevices but this had no effect.

I use different GDlib instances so this shouldnt happen or?

Greets
dic

dixus
Posts: 39
Joined: Wed Feb 10, 2010 9:23 am

Re: TWAIN threading issue

Post by dixus » Tue Feb 23, 2010 10:50 am

I got it. You need to run TwainCloseSourceManager(). Looks like TwainGetDefaultSourceName opens the SourceManager automatically but doesnt close it.

Here is a test project if anybody else will have same issues.

Code: Select all

using System;
using System.Windows.Forms;
using System.Threading;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {

        public Form1()
        {
            InitializeComponent();
            //Make it fail
            GdPicture.GdPictureImaging gd = new GdPicture.GdPictureImaging();
            gd.TwainGetDefaultSourceName(this.Handle);

            //workerthread will hang (message loop) if you forget this
            gd.TwainCloseSourceManager(IntPtr.Zero);

        }

        private void button1_Click(object sender, EventArgs e)
        {
            GDTwainThread worker = new GDTwainThread();
            Thread thread = new Thread(worker.Scan);
            thread.Start();
        }
    }

    class GDTwainThread
    {
   
        [STAThread]
        public void Scan()
        {
            int ImageID;
            GdPicture.GdPictureImaging gd = new GdPicture.GdPictureImaging();
            gd.SetLicenseNumber("XXXX");
            gd.TwainLogStart("c:\\twainlog.txt");
            gd.TwainOpenDefaultSource(IntPtr.Zero);
            //will hang if we run gd code out of thread context before
            ImageID = gd.TwainAcquireToGdPictureImage(IntPtr.Zero);
            gd.SaveAsJPEG(ImageID, "test.jpg");
            gd.TwainCloseSource();
            gd.TwainUnloadSourceManager(IntPtr.Zero);
        }
    }
}

Post Reply

Who is online

Users browsing this forum: No registered users and 10 guests