title: WIA Twain support C#
body: <p>How can I use WIA and Twain in C#? The TWIAIN/C# example found at <a href="http://www.codeproject.com/KB/dotnet/twaindotnet.aspx" rel="nofollow noreferrer">http://www.codeproject.com/KB/dotnet/twaindotnet.aspx</a> Throws an exception at line 59 on TwainLib.cs "an attempt was made to load a program with an incorrect format." on Vista 64.</p>
  
  <p>I would use WIA but it does not have support for all of the devices I want to use.</p>
  
  <p>Is there a simple way to enable TWAIN support in WIA in C#? I know it can be done but I cannot find any documentation on the subject. I am not looking for a commercial product. I can figure out how to use WIA just fine - but its the fact that I cant enable TWIAN support that is annoying.</p>
  
  <p>Examples in C++/CLI or VB.net are also welcome.</p>
  
  <p>Thanks.</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Thanks, cristianlibardo. You helped me out a lot and I might just continue to use TWIAN for now. But I am still wanting to use WIA; so I will not accept your answer yet. Here is some more info for people just seeing this post. All are in response to this answer:</p>
  
  <p>Yup, that did it for the TWIAN support; thanks! I still want to use WIA though; but now I have something to work with. However, when I select my USB camera as the source and hit acquire, the app hangs. My camera works on other, commercial, TWIAN applications.</p>
  
  <p>By commenting out the lines 100 though 104 (code that checks to see if "DScap( appid, srcds, TwDG.Control, TwDAT.Capability, TwMSG.Set, cap );" returns TwRC.Success my Camera now works. I have no idea what this code does; as documentation is next-to-nothing on this subject.</p>
  
  <p>OK; its a const called "CAP_XFERCOUNT" that has something to do with scanning multiple images per session. Makes seance that a camera would not support it.</p>