WINDOWS WIA 驱动开发 0x80210015,0x80210016错误

来源:互联网 发布:移动5g网络 编辑:程序博客网 时间:2024/06/05 20:44

WIA是基于COM技术的,直接引用COM的DLL即可。

我问过商家,现在WIA是可以通过TWAIN进行驱动的。但是代码是不同的。

<span style="font-size:12px;">   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;            }            if (imageFile != null)            {                string fileName = Application.ExecutablePath + @"cache.bmp";                imageFile.SaveFile(fileName);                using (FileStream stream = new FileStream(fileName, FileMode.Open,                    FileAccess.Read, FileShare.Read))                {                    pictureBox1.Image = Image.FromStream(stream);                }                File.Delete(fileName);            }</span>

就是这样,但是执行出错。异常来自 HRESULT:0x80210015

详细的错误代码如下:

http://msdn.microsoft.com/en-us/library/windows/desktop/ms630183(v=vs.85).aspx

0 0