public string[] PromptForImage(IntPtr parentWindowHandle, WiaDevice device)
        {
            var fileName   = Path.GetRandomFileName();
            var itemHandle = IntPtr.Zero;
            var fileCount  = 0;
            var filePaths  = new string[10];
            var hr         = Version == WiaVersion.Wia10
                ? NativeWiaMethods.GetImage1(Handle, parentWindowHandle, SCANNER_DEVICE_TYPE, 0, 0, Path.Combine(Paths.Temp, fileName), IntPtr.Zero)
                : NativeWiaMethods.GetImage2(Handle, 0, device.Id(), parentWindowHandle, Paths.Temp, fileName, ref fileCount, ref filePaths, ref itemHandle);

            if (hr == 1)
            {
                return(null);
            }
            WiaException.Check(hr);
            return(filePaths ?? new[] { Path.Combine(Paths.Temp, fileName) });
        }
Example #2
0
        public static bool FeederReady(this WiaDevice device)
        {
            int status = (int)device.Properties[WiaPropertyId.DPS_DOCUMENT_HANDLING_STATUS].Value;

            return((status & WiaPropertyValue.FEED_READY) != 0);
        }
Example #3
0
        public static bool SupportsDuplex(this WiaDevice device)
        {
            int capabilities = (int)device.Properties[WiaPropertyId.DPS_DOCUMENT_HANDLING_CAPABILITIES].Value;

            return((capabilities & WiaPropertyValue.DUPLEX) != 0);
        }
        public static bool SupportsFeeder(this WiaDevice device)
        {
            var capabilities = (int)device.Properties[WiaPropertyId.DPS_DOCUMENT_HANDLING_CAPABILITIES].Value;

            return((capabilities & WiaPropertyValue.FEEDER) != 0);
        }