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.
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