我多次阅读Twain规范,但我还没有找到解决这个问题的方法。 似乎我传递给DMS_ENTRY的参数之一无效。 这是我正在使用的Entry方法的重载:
[DllImport("twaindsm.dll", EntryPoint = "#1")]
internal static extern TwainResultCode DsmEntryWithParent(TwainIdentity origin, TwainIdentity dest, uint dataGroup, ushort dataArgument, ushort message, ref IntPtr refPtr);
两个TwainIdentity对象是:
var origin = new TwainIdentity();
origin.Id = IntPtr.Zero;
// SEEMS THAT NEXT FOUR STRINGS ARE MANDATORY WITH 'TWAINDSM'
origin.Version.Info = "test";
origin.Manufacturer = "Me";
origin.ProductFamily = "test";
origin.ProductName = "Scan tool";
var dest = new TwainIdentity();
dest.Id = IntPtr.Zero;
我传递给该方法的其他参数是:
uint dataGroup = 0x0001; // DG_CONTROL
ushort dataArgument = 0x0004; // DAT_PARENT
ushort message = 0x0301; // MSG_OPENDSM
IntPtr refPtr = [currentForm].Handle; // APPLICATION MAIN FORM'S HANDLE
按照官方文档中的说法,这些参数应该是正确的。 谁能告诉我哪里出错?
提前谢谢