简体   繁体   English

如何不断监视WinForm应用程序中的用户输入

[英]How to constantly monitor user input in a WinForm application

In my WinForm application I need a login system to enable/disable some functionality. 在我的WinForm应用程序中,我需要一个登录系统来启用/禁用某些功能。 This login is made using a magnetic card readed by a USB card reader that works in Keyboard emulation. 使用可在键盘仿真中工作的USB读卡器读取的磁卡进行此登录。 If I force the user to select a textbox and then swipe the card I can receive the code in the textbox and then process it, but how can I do if I want to get this code in any moment also if a textbox is not the current selected control? 如果我强迫用户选择一个文本框,然后刷卡,那么我可以在文本框中接收代码,然后对其进行处理,但是如果文本框不是当前文本框,我也想在任何时候获取此代码怎么办?选择控件?

I'm thinking about a background console application just to receive the code whit Console.ReadLine() but it doesn't work when I'm focused on my winform. 我在考虑一个后台控制台应用程序,只是为了接收带有白色代码的Console.ReadLine(),但是当我专注于Winform时,它将无法正常工作。

Just a concept from my own similiar app (with fingerprint reader): 只是我自己的类似应用程序(带有指纹读取器)的一个概念:

  1. Create Windows service app which will monitor your USB card reader device; 创建Windows服务应用程序,它将监视您的USB读卡器设备;
  2. Link this service with some DLL library in your WinForms app; 将此服务与WinForms应用程序中的某些DLL库链接;
  3. If any activity will be detected, call proper method in linked DLL library and do all requested operations. 如果将检测到任何活动,请在链接的DLL库中调用适当的方法并执行所有请求的操作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM