我正在开发的应用程序是使用扫描仪,它可能属于少数几种类型之一。我需要识别附加的扫描器,给出一个选择从那些附加的默认扫描器,并改变这个选择时,随时需要。到目前为止,我想出了一个解决方案:
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
}
}这对我来说是可行的,因为我知道在信息“标题”中应该期待什么。然而,有几个问题:
发布于 2009-02-10 03:14:58
您可以按照这条线中的建议尝试
https://stackoverflow.com/questions/530892
复制相似问题