Click here to Skip to main content
15,888,610 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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

C#
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 listbox

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

plz i need any help
Posted
Comments
Peter_in_2780 30-Aug-12 20:10pm    
A quick google for "80040154" suggests that you might need to register the class (in a DLL) on the XP machine. Alternatively, maybe that class is not part of XP or the .NET framework you have installed there.
nagiub2007 30-Aug-12 20:13pm    
thanks for replay
but i tried but i don't know how
can u help me

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900