title: Document scanning on Windows C# with an incremental custom progress UI?
body: <p>How can I incrementally scan a document on Windows, from C#, while getting callbacks to show pieces of the image as they come in, and update my own <em>custom</em> progress UI?</p>
  
  <p>It looks like the scanner API options include:</p>
  
  <ul>
  <li>WIA, WIA Script Automation (windows)</li>
  <li>TWAIN (windows, linux)</li>
  <li>ImageKit and ImageCaptureCore (MacOS)</li>
  <li>SANE (linux)</li>
  <li>ISIS (windows, expensive commercial). </li>
  </ul>
  
  <p><em>My attempt on WIA Script Automation:</em></p>
  
  <p>I have a simple C# application which uses Windows WIA Script Automation to scan a document. (see the <a href="https://github.com/jeske/WIADemo" rel="nofollow noreferrer">code on github</a>) However, during the Scan the UI is hijacked by a popup progress dialog.</p>
  
  <p>The current code scans using the WIA Scripting <code>CommonDialog.showTransfer</code> (<a href="https://github.com/jeske/WIADemo/blob/master/WIADemo/WIAScanner.cs#L167" rel="nofollow noreferrer">see here</a>), which shows a popup progress bar dialog. I understand I can instead use <a href="https://msdn.microsoft.com/en-us/library/windows/desktop/ms630557(v=vs.85).aspx" rel="nofollow noreferrer"><code>Item.Transfer</code></a>, however, it blocks for the entire duration and offers no callback so I can update my own custom progress UI (or cancel the transfer).</p>
  
  <p>Is there any way to do a non-blocking scan with WIA, or to get progress callbacks?</p>
  
  <p>Do I have to use TWAIN?</p>