嗨,我真的需要帮助 我键入此代码以将所有连接的扫描仪设备加载到acombobox 但它在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();