如何使用 C#、Windows 应用程序获取扫描仪的唯一信息(可能是序列号或其他信息)



我需要存储用户的默认扫描仪选择。

我不知道那些写在扫描仪下的序列号是否存储在某个地方,但我需要获得有关扫描仪的特殊细节。否则可能会导致冲突。

如何使用 C# 做到这一点?

我不确定我是否应该回答这个问题,但因为前段时间选择扫描仪对我来说是一个问题,我决定给你一个提示......

这就是你用WIAAut做

的事
CommonDialogClass commonDialog = new CommonDialogClass();
Device device = commonDialog.ShowSelectDevice(WiaDeviceType.ScannerDeviceType, true, false);
if (device == null)
    return;
string deviceID = device.DeviceID;

编辑:

稍后如何获取设备的再举一个例子:

DeviceManager deviceManager = new DeviceManager();
DeviceInfo deviceInfo =
    (from DeviceInfo di in deviceManager.DeviceInfos
     where di.DeviceID == deviceID
     select di).SingleOrDefault();

相关内容

最新更新