Tuesday, February 10, 2009

Scanner Update

I tried the solution suggested in this thread. HOW TO RETRIEVE INSTALLED SCANNER

I did the following:

  • Downloaded wiaaut.dll

  • Copied it to system32

  • Registered it with "regsvr32 wiaaut.dll" (successfully)

  • Added a reference to wiaaut.dll to my project in Visual Studio.NET

  • Checked that the Windows Image Acquisition (WIA) service is running
  • Next, I added and debugged the following code:

    WIA.DeviceManager manager = new WIA.DeviceManagerClass();
    WIA.DeviceManagerClass managerClass = new WIA.DeviceManagerClass();

    string wdeviceName = "";
    foreach (WIA.DeviceInfo info in manager.DeviceInfos)
    if (info.Type == WIA.WiaDeviceType.ScannerDeviceType)
    foreach (WIA.Property p in info.Properties)
    if (p.Name == "Name")
    wdeviceName = ((WIA.IProperty)p).get_Value().ToString();

    However, the manager.DeviceInfos is always empty. I have 2 scanners attached, one of them shows in Control Panel->Scanners and Cameras, one doesn't, and both show under "Imaging Devices" in Device manager.

    At this point, the only idea I have is that the scanner drivers just do not support WIA. As long as I have no way to check if this is true or not, I'll have to stick to the yesterday's solution.

    by . Also posted on my website

    No comments: