嗨,我真的需要帮助,我键入此代码以将所有连接的扫描仪设备加载到组合框,但它在 windows xp 的 windows 7 中工作我得到了这个嘈杂的异常
由于以下错误,检索具有 CLSID {00020819-0000-0000-C000-000000000046} 的组件的 COM 类工厂失败:80040154。
这是我的代码
public static void LoadScanners(ComboBox c)
{
MC.enableWIA();
string deviceName = "";
c.Items.Clear();
WIA.DeviceManager deviceManager = new WIA.DeviceManagerClass();
// Loop through the list of devices and add the name to the combobox
foreach (WIA.DeviceInfo info in deviceManager.DeviceInfos )
{
if (info.Type == WIA.WiaDeviceType.ScannerDeviceType)
{
foreach (WIA.Property p in info.Properties)
{
if (p.Name == "Name")
{
deviceName = ((WIA.IProperty)p).get_Value().ToString();
c.Items.Add(deviceName);
}
}
}
}
}
此行发生异常
WIA.DeviceManager deviceManager = new WIA.DeviceManagerClass();