public string[]? PromptForImage(IntPtr parentWindowHandle, WiaDevice device, string?tempFolder = null) { tempFolder ??= Path.GetTempPath(); var fileName = Path.GetRandomFileName(); IntPtr itemHandle = IntPtr.Zero; int fileCount = 0; string[] filePaths = new string[0]; var hr = Version == WiaVersion.Wia10 ? NativeWiaMethods.GetImage1(Handle, parentWindowHandle, SCANNER_DEVICE_TYPE, 0, 0, Path.Combine(tempFolder, fileName), IntPtr.Zero) : NativeWiaMethods.GetImage2(Handle, 0, device.Id(), parentWindowHandle, tempFolder, fileName, ref fileCount, ref filePaths, ref itemHandle); if (hr == 1) { return(null); } WiaException.Check(hr); return(filePaths ?? new[] { Path.Combine(tempFolder, fileName) }); }
public static bool FeederReady(this WiaDevice device) { int status = (int)device.Properties[WiaPropertyId.DPS_DOCUMENT_HANDLING_STATUS].Value; return((status & WiaPropertyValue.FEED_READY) != 0); }
public static bool SupportsDuplex(this WiaDevice device) { int capabilities = (int)device.Properties[WiaPropertyId.DPS_DOCUMENT_HANDLING_CAPABILITIES].Value; return((capabilities & WiaPropertyValue.DUPLEX) != 0); }