1

hi really i need help in this i typed this code to load all connected scanner device to acombobox but it work in windows 7 in windows xp i got this noisy exception

Retrieving the COM class factory for component with CLSID {00020819-0000-0000-C000-000000000046} failed due to the following error: 80040154.

this is my code

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);
                   }
               }
           }


       }
   }

exception occur at this line

 WIA.DeviceManager deviceManager = new WIA.DeviceManagerClass();
user1637402
  • 87
  • 4
  • 15
  • WIA doesn't exist on Windows XP until SP3. If you're running an earlier version, it's simply not there. It's also possible that you're requesting WIA 2.0's GUID, which doesn't exist until Vista - see [MSDN here](http://msdn.microsoft.com/en-us/library/windows/hardware/gg463512.aspx). – Ken White Aug 31 '12 at 00:06
  • thanks for replay but give me any suggestions pleaze to retrieve all scanners? – user1637402 Aug 31 '12 at 00:16
  • I knew why you might be getting the exception, and I explained that; I don't have an answer to your question about listing the scanners without WIA, so I didn't post an answer - I posted a comment instead. – Ken White Aug 31 '12 at 00:18
  • any case thanks 4 replay – user1637402 Aug 31 '12 at 00:24

0 Answers0