1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > 未检测到与wia兼容的设备_WIA-TWAIN 兼容性

未检测到与wia兼容的设备_WIA-TWAIN 兼容性

时间:2023-12-22 00:49:56

相关推荐

未检测到与wia兼容的设备_WIA-TWAIN 兼容性

WIA-TWAIN 兼容性WIA-TWAIN Compatibility

04/20/

本文内容

如果一个设备可以有两个或多个驱动程序,请彻底测试这些驱动程序以实现彼此兼容。If a device can have two or more drivers, test these drivers thoroughly for compatibility with each other. 例如,如果一个驱动程序使设备处于不可用状态 (例如,驱动程序未在某些协议) 中发送关闭会话消息,则当其他驱动程序尝试与设备通信时,该驱动程序可能会失败。For example, if one driver leaves the device in an unusable state (such as the driver not sending the close session message in some protocol), the other driver might fail when it tries to communicate with the device. 串行设备通常会发生这种情况。This situation happens often with serial devices.

同一 DLL 中的 WIA 和 TWAINWIA and TWAIN in the Same DLL

如果从单个 DLL 同时运行 WIA 驱动程序和 TWAIN 驱动程序,WIA 服务和 TWAIN 应用程序都将加载此 DLL 的实例。If you are running a WIA driver and a TWAIN driver at the same time from a single DLL, the WIA service and the TWAIN application will both load an instance of this DLL. DLL 的 WIA 实例将生成 WIA 项树。The WIA instance of the DLL will build the WIA item tree. 此树表示相机上的文件夹和图像。This tree represents the folders and images on your camera. 使用 WIA (如我的电脑或扫描仪和照相机向导) 的任何应用程序都将在您的驱动程序中包含项树的副本。Any application that uses WIA (such as My Computer or Scanner and Camera Wizard) will have a copy of the item tree in your driver.

删除或通过 TWAIN 驱动程序添加图像时,不会向 WIA 驱动程序通知此更改。When an image is deleted or added by means of the TWAIN driver, the WIA driver is not notified of this change. 因此,WIA 项树将包含已删除的映像,或者不包含已添加的映像。As a result, the WIA item tree either will contain images that have been deleted, or will not contain images that have been added. 在任一情况下,驱动程序必须刷新其项树。In either case, the driver must refresh its item tree. 为此,TWAIN 驱动程序必须对 WIA 驱动程序进行排序,以便在添加或删除图像时刷新其项树。To do so, the TWAIN driver must order your WIA driver to refresh its item tree when an image has been added or deleted.

执行此操作的一种方法是从你的 TWAIN 驱动程序调用 CoCreateInstance (CLSID _ IWiaDevMgr,... ) ,枚举所有设备,并搜索你的设备。One way of doing this is to call CoCreateInstance(CLSID_IWiaDevMgr,...) from your TWAIN driver, enumerate all the devices, and search for your device. 通过此枚举标识驱动程序的一种方法是在 WIA 驱动程序中创建自定义属性,以便如果 TWAIN 驱动程序查询此属性并且它存在,您将知道它是 WIA 驱动程序。One way to identify your driver through this enumeration is to create a custom property in your WIA driver so that if the TWAIN driver queries for this property and it exists, you will know that it is your WIA driver. 获取用于驱动程序的 IWiaItem 后,请将命令发送到驱动程序以重新生成其树 (例如,在调用 IWiaItem::D evicecommand 方法) 中向其发送 WIA CMD _ SYNCHRONIZE命令。After you have the IWiaItem for your driver, send a command to your driver to rebuild its tree (for example, send it a WIA CMD_SYNCHRONIZE command in a call to the IWiaItem::DeviceCommand method). Microsoft Windows SDK 文档中介绍了 CoCreateInstance、 IWiaDevMgr 和 IWiaItem 。CoCreateInstance, IWiaDevMgr, and IWiaItem are described in the Microsoft Windows SDK documentation.

刷新 WIA 项树的另一种方法是在 WIA 驱动程序中创建命名 事件 。Another way of refreshing the WIA item tree is to create a named event in the WIA driver. WIA 驱动程序中的线程随后可以等待此事件发出信号。A thread in your WIA driver can then wait for this event to be signaled. 每次通过 TWAIN 驱动程序删除或添加图像时,TWAIN 驱动程序会通过调用此命名事件) # A3 的 Windows SDK 文档中所述的 (SetEvent 来 (。Whenever you delete or add an image by means of the TWAIN driver, the TWAIN driver signals (by calling SetEvent (described in the Windows SDK documentation)) on this named event. 然后,将释放 WIA 驱动程序中的线程,WIA 驱动程序将重建树。The thread in your WIA driver will then be released, and the WIA driver will rebuild the tree.

无论采用哪种方式,都应该重建树,使其反映对照相机或扫描仪上的实际图像所做的任何更改。Either way, you should rebuild your tree so that it reflects any changes made to the actual images on the camera or scanner. 确保每次更新树时,都要通过从项树中添加或删除项来对事件进行排队 (例如,将 "WIA _ 事件 _ 项 _ 已删除" 或 "wia" _ 事件 _ 树 _ 更新 (有关这些和其他 WIA 事件标识符的说明,请参阅 Windows SDK 文档) # A3。Make sure that whenever you update the tree by adding or deleting an item from the item tree, that you queue an event (for example, WIA_EVENT_ITEM_DELETED or WIA_EVENT_TREE_UPDATED (for a description of these and other WIA event identifiers, see the Windows SDK documentation)). 如果在树发生更改时成功发送事件,这将解决我的电脑和其他 WIA 应用程序未自动更新的问题。If you successfully send an event when your tree changes, this will solve the problem with My Computer and other WIA applications not being updated automatically.

注意 尽管你的 TWAIN 和 WIA 驱动程序可能存在于同一个 DLL 中,但 WIA 和 TWAIN 驱动程序不能共享相同的 UI。Note While your TWAIN and WIA drivers may exist in the same DLL, WIA and TWAIN drivers cannot share the same UI. 每个驱动程序都必须有自己的 UI。Each driver must have its own UI.

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。