C# WIA Image Scanning fails with HRESULT: 0x80070050

☆樱花仙子☆ 提交于 2019-12-02 01:05:36

Solved.

It turns out that WIA actually stores captured images as temporary files in the Users profile temp folder, so:

Path.GetTempPath()

or C:\Users\USER_PROFILE\AppData\Local\Temp\

Files are stored in the format imgXXXX.tmp

In our case - the reason this caused an issue, which doesn't seem to be documented anywhere on the net, is that we polled the scanner every few seconds - creating a temp file, as there are only 4x's, there can be a max of 65K temp files before WIA will bug out.

Setting up a routine to clear out old image files from this temp folder immediately resolved the issue.

I came across this same problem when trying to use WIA to read images off of a camera device. The proper solution is to dispose of the WIA.ImageFile properly. This cleans up the tmp file.

Marshal.ReleaseComObject(Image1);

I found this on CodePrjoct, link

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!