none
WIA问题 RRS feed

  • 问题

  • 请问执行以下代码后却提示“当从 COM 方法调用返回无法识别的 HRESULT 时引发的异常。”能告诉我是怎么回事吗?谢谢!

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;
    using System.Runtime.InteropServices;
    using System.IO;
    using WIA;
    
    namespace TwainGui
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }
    
            private void button1_Click(object sender, EventArgs e)
            {
                ImageFile imageFile = null;
                CommonDialogClass cdc = new WIA.CommonDialogClass();
    
                try
                {
                    imageFile = cdc.ShowAcquireImage(WIA.WiaDeviceType.ScannerDeviceType, WIA.WiaImageIntent.TextIntent,
                        WIA.WiaImageBias.MaximizeQuality, "{00000000-0000-0000-0000-000000000000}", true, true, false);
                }
                catch (System.Runtime.InteropServices.COMException)
                {
                    imageFile = null;
                }
            }
        }
    }
    


    Raymond

    2012年5月26日 20:03

答案

全部回复