Search code examples
c#64-bittwain

Twain Failure Description


I am using Windows 8.1 x64 After a long time search I could not find any answer for my question. I try to use Twain for scanning. My application works correctly in x86 mode. But for some reason, I'm now forced to switch to "AnyCPU". So that I'm trying to use new 'TWAINDSM.dll' instead of 'twain_32.dll'. But it fails while initializing: "TwRC.Failure" in:

    TwainNative.DSMparent(this._Appid, IntPtr.Zero, TwDG.Control, TwDAT.Parent, TwMSG.OpenDSM, ref hwndp);

which _Appid is

    this._Appid = new TwIdentity
                  {
                      Id = IntPtr.Zero,
                      Version = {MajorNum = 1, MinorNum = 1, Language = LanguageUSA, Country = CountryUSA, Info = "Mohammad"},
                      ProtocolMajor = TwProtocol.Major,
                      ProtocolMinor = TwProtocol.Minor,
                      SupportedGroups = (int)(TwDG.Image | TwDG.Control),
                      Manufacturer = "Kod Efisien Sdn Bhd",
                      ProductFamily = "TWAIN 32 Scanner",
                      ProductName = "ScanSoft"
                  };

in log file:

[151040065 dsm.cpp 399 183 0000000000002174] TWAIN Working Group

[151040065 dsm.cpp 400 183 0000000000002174] TWAIN 64 Source Manager (Image Acquisition Interface)

[151040065 dsm.cpp 401 183 0000000000002174] version: 2, 3, 0, 0

[151040065 dsm.cpp 2368 183 0000000000002174] -> DSM

[151040065 dsm.cpp 2377 183 0000000000002174] DG_CONTROL/DAT_PARENT/MSG_OPENDSM

[151040065 apps.cpp 347 183 0000000000002174] AppId.ProductName is empty

[151040065 apps.cpp 654 183 0000000000002174] Condition Code: Data parameter out of range

[151040065 dsm.cpp 2432 183 0000000000002174] TWRC_FAILURE

Thanks for any help.


Solution

  • I've got the answer at that time. Sorry for taking long time to answer it. As I mentioned in above comment: It works well. dynamsoft.com/Products/.Net-TWAIN-Scanner.aspx