如何在Windows 7上捕获扫描仪按钮的事件-WIA 2.0 [英] How to catch event for scanner button on Windows 7 - WIA 2.0

查看:199
本文介绍了如何在Windows 7上捕获扫描仪按钮的事件-WIA 2.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我想问你,如何在Windows 7上通过WIA 2.0捕获扫描仪按钮事件.
该代码不起作用:

Hello,

I would like to ask you, how to catch scanner button event by WIA 2.0 on Windows 7.

This code not working:

Device device;
DeviceManagerClass dManager = new DeviceManagerClass();
CommonDialogClass cdlg = new CommonDialogClass();
device = cdlg.ShowSelectDevice(WiaDeviceType.ScannerDeviceType, false, false);
dManager.RegisterEvent(EventID.wiaEventScanImage, device.DeviceID);
dManager.OnEvent += new _IDeviceManagerEvents_OnEventEventHandler(device_OnEvent);



也许,扫描仪和win 7有问题.我使用HP DeskJet F2180.如果我没有安装HP软件(多合一),则按扫描仪按钮无济于事-Windows 7不知道该按钮被按下了.使用已安装的HP软件扫描仪按钮,可以执行一些HP扫描仪软件,但我想在应用程序中捕获此事件.

我有较旧的HP扫描仪,当我按下扫描仪按钮时,在WinXP上显示了带有程序的框(这些程序可以通过Windows注册表更改)或我的程序处理事件.但是Window 7却不执行任何操作.

感谢您的答复.

Pav.



Maybe, there is problem with scanner and win 7. I use HP DeskJet F2180. And if I dont have install HP softwares (All-in-one), pushing scanner button do nothing - windows 7 dont know that button was pressed. With installed HP softwares scanner button execute some HP scaner software, but I want catch this event in my aplication.

I had older HP scanner and when I pushed scanner button, on WinXP was showed box with programs (these programs can be changed by windows registry) or my program handle event. But Window 7 do/show nothing.

Thanks for any reply.

Pav.

推荐答案

您去过此网站吗?

http://msdn.microsoft.com/en-us/library/ms630368 (v = vs.85).aspx [ http://stackoverflow.com/questions/8966/using-c-wia-version-2-0-on-vista-to-scan [
Have you been to this web site yet?

http://msdn.microsoft.com/en-us/library/ms630368(v=vs.85).aspx[^]

At the bottom of the page, there''s a link to sample code.

I hate to do it, but here''s a link to a similar question (regarding Vista, but Win7 is just Vista in a better-fitting suit) on another site:

http://stackoverflow.com/questions/8966/using-c-wia-version-2-0-on-vista-to-scan[^]

If neirther of those links help, google returned 12,000 results for "c# WIA 2.0".


这篇关于如何在Windows 7上捕获扫描仪按钮的事件-WIA 2.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆