WIA的DeviceManager有0个DriveInfos

时间:2018-05-24 12:47:49

标签: c# .net wia

我的WIA Device Manager semms始终有0 DeviceInfo个条目。 这是我的代码:

DeviceManager m = new DeviceManager();
Console.WriteLine(m.DriveInfos.Count); // Always is 0 (Problem)
// Process Devices
for (int i = 1; (i <= m.DeviceInfos.Count); i++) // Assuming multiple scanners
{
    try
    {
        if (m.DeviceInfos[i].Type == WiaDeviceType.ScannerDeviceType)
        {

            DeviceInfo di = m.DeviceInfos[i];
            string n = di.Properties["Name"].get_Value().ToString();
            Console.WriteLine("Scanner found: "+n);
            scanners.Add(di); //Add to list for later use
        }
    } catch { }
}

是否有WIA的替代方案或是否有解决该问题的方法?

0 个答案:

没有答案