C# WIA Image Scanning fails with HRESULT: 0x80070050

前端 未结 2 1383
礼貌的吻别
礼貌的吻别 2021-01-21 13:17

I\'m hoping someone has come across this - I\'m trying to capture images from a document scanner using WIA, however on random machines when attempting to transfer the image resu

2条回答
  •  遇见更好的自我
    2021-01-21 14:09

    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.

提交回复
热议问题