The application I'm working on is using a scanner, which may belong to one of a few types. I need to identify the attached scanner(s), give an option to select a default scanner from those attached and also change this selection whenever required. So far I came up with this solution:
ManagementObjectSearcher search = new System.Management.ManagementObjectSearcher("SELECT * From Win32_PnPEntity");
ManagementObjectCollection deviceCollection = search.Get();
foreach (ManagementObject info in deviceCollection)
{
string deviceName = Convert.ToString(info["Caption"]);
if( /* check something about deviceName */)
{
// add a scanner to the list
}
}
This works for me because I know what to expect in the info["Caption"]. However, there are a couple questions:
You could try the Windows Image Acquisition Automation Library as suggested in this thread