-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DTWAIN_IsDeviceOnLine always return 0 update version 5.4.3 #94
Comments
You will need to use the DTWAIN_ArrayGetAtLong(array, 0, int) to determine the actual value in the returned array (the last parameter of the DTWAIN_GetCapValues call, which is filled in by DTWAIN on return of DTWAIN_GetCapValues). So it would look like:
|
thanks for you reply. I recreate this different return value. using System;
using Dynarithmic;
using Nito.AsyncEx;
namespace ConsoleApplication1
{
internal class Program
{
private static readonly AsyncContextThread asyncContextThread = new AsyncContextThread();
private static IntPtr sourceId;
private static R Post<R>(Func<R> callback)
{
var r = default(R);
asyncContextThread.Factory.Run(() => r = callback()).Wait();
return r;
}
public static void Main(string[] args)
{
Post(() =>
{
var status = TwainAPI.DTWAIN_SysInitialize();
// TwainAPI.DTWAIN_EndTwainSession();
TwainAPI.DTWAIN_StartThread(status);
sourceId = TwainAPI.DTWAIN_SelectSource();
var isDeviceOnLine = TwainAPI.DTWAIN_IsDeviceOnLine(sourceId);
Console.WriteLine("sourceId:" + sourceId + ", isDeviceOnLine:" + isDeviceOnLine); // return 1
return 0;
});
var mainThreadOL = TwainAPI.DTWAIN_IsDeviceOnLine(sourceId);
// different thread call DTWAIN_IsDeviceOnLine
// in 5.2.9 == 1
// in 5.4.3 == 0
Console.WriteLine("sourceId:" + sourceId + ", mainThreadOL:" + mainThreadOL);
}
}
} Nito.AsyncEx, make a worker thread for do scanner operation (like my work is desktop app, do scan not on main thread). I changed my code for support 5.4.3.
|
You will still need to generate a TWAIN log to determine how your device is handling the TWAIN calls. |
I updated dtwain32u.dll 5.2.0.9 -> the last version 5.4.3.
DTWAIN_IsDeviceOnLine always return 0.
And I rollback 5.2.0.9 work well.
Code like this, I want to check the device is ready.
The text was updated successfully, but these errors were encountered: