I am trying to use WIA for scanning and am running into a little trouble. I am using the CommonDialog.ShowAcquisitionWizard method as documented on MSDN. The problem is, there is no object returned from the method. I need to know when the scanning is complete and I have tried multiple ways (Thread) and have failed. Can someone please suggest a method I should use to determine whether or not the scan is complete and/or the dialog is closed?
My current code:
private void DoScan()
{
WIA.CommonDialog dialog = new WIA.CommonDialog();
Device device = dialog.ShowSelectDevice(WiaDeviceType.ScannerDeviceType);
dialog.ShowAcquisitionWizard(device);
// immediately jumps to this line...
string test = "is it done?";
// if i put a breakpoint there, the WIA interface never appears, I have to continue before it will show.
// so a threading.sleep(5000) won't work...
}