有一个我一直用来远程控制数码相机的旧程序,以便自动拍照并将它们传输到 PC。该程序基于 WIA,据我所知,它最初是在 Windows XP 上设计和使用的。
最近将它从档案中取出,并一直试图让它在使用相同相机的 64 位 Windows 7 上工作。找到相机并触发捕获工作没有问题。但是在执行此行时:
//device of type WIA.Device
Item item = device.ExecuteCommand(CommandID.wiaCommandTakePicture);
返回 null,让我没有图像参考来传输。一直在寻找解决方案,但一直无法提出任何建议。找到另一个 QA 站点,其中一个答案建议使用:
//manager of type WIA.DeviceManager, device of type WIA.Device
manager.RegisterEvent(EventID.wiaEventItemCreated, device.DeviceID);
manager.OnEvent += new _IDeviceManagerEvents_OnEventEventHandler(manager_OnEvent);
在图像捕获后,人们会收到包含 itemID 的事件。已经尝试过了,并且没有引发任何事件。