Click here to Skip to main content
15,896,118 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
Hi I want to know how to get list of scanners available in my machine. then want to display the names in dropdownbox.
Posted
Comments
Sampath Lokuge 6-Nov-13 1:59am    
Is this windows app?
sencsk 6-Nov-13 2:00am    
yes

You can use the Windows Image Acquisition Automation Library for that.Check below mentioned links for more information.

C#
WIA.DeviceManager manager = new WIA.DeviceManagerClass();

string deviceName = "";

foreach(WIA.DeviceInfo info in manager.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();

Console.WriteLine(deviceName);

}

}

}

}


For more info:HOW TO RETRIEVE INSTALLED SCANNER

Microsoft Windows Image Acquisition Library v2.0

I hope this will help to you.
 
Share this answer
 
v3
Comments
sencsk 6-Nov-13 3:15am    
I'm using accusoft Image gear.

var imGearTwain = new ImGearTWAIN();
_isDeviceOpened = true;
imGearTwain.OpenSource("");
for (var i = 0; i < imGearTwain.DataSources.Count - 1; i++)
{
cmbBox.Items.Add(imGearTwain.DataSources[i]);
}

But i got exception here"imGearTwain.OpenSource("");" Cannot open Data Source Manager.
omoridi 23-Jun-15 4:36am    
I think if you check with description properties is better than name.
It's been a long time since I've worked in a Windows environment, but I would suggest that you look at using WMI.
ManagementObjectSearcher searcher = new ManagementObjectSearcher("Select * from Win32_PnPEntity");
ManagementObjectCollection coll = searcher.Get();

 foreach (ManagementObject any in coll)
{
  // Check for device name
}
 
Share this answer
 
v2
Comments
Sergey Alexandrovich Kryukov 6-Nov-13 2:28am    
Correct, a 5. It's a big deal to sort out the collection to identify the scanner, but this is a good place to start.
—SA

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