使用WIA Automation示例时出错 [英] Error Using WIA Automation Samples

查看:96
本文介绍了使用WIA Automation示例时出错的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将我的机器中的WIA图层示例用于教育目的.但这给了我以下Visual Basic 2008中的错误.此代码中显示的错误


I''m Using WIA Layer Sample in my machine for a educational purpose. But it gives me following Error In Visual Basic 2008. Error Shown on this code


Picture1.BackgroundImage = img.ARGBData.Picture(w, h)



错误是这



Error Is this

Unable to cast COM object of type 'System.__ComObject' to class type 'System.Drawing.Image'. Instances of types that represent COM components cannot be cast to types that do not represent COM components; however they can be cast to interfaces as long as the underlying COM component supports QueryInterface calls for the IID of the interface.

推荐答案

您显然有一个错误在img.ARGBData.Picture(w,h)调用中.您确定返回System.Drawing.Image吗?如果不是,则可能需要弄清楚此方法返回的内容,然后弄清楚如何将此返回值强制转换为System.Drawing.Image.
如果您的问题中没有任何更多信息,您将找不到更好的答案.
You obviously have an error in the img.ARGBData.Picture(w, h) call. Are you sure it returns a System.Drawing.Image? If not, perhaps you need to figure out what this method returns and then figure out how to cast this return value to a System.Drawing.Image.
Without any more information in your question, you won''t get a much better answer.


Marcus 这对我有帮助


这篇关于使用WIA Automation示例时出错的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆