简体   繁体   中英

How to constantly monitor user input in a WinForm application

In my WinForm application I need a login system to enable/disable some functionality. This login is made using a magnetic card readed by a USB card reader that works in Keyboard emulation. 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.

Just a concept from my own similiar app (with fingerprint reader):

  1. Create Windows service app which will monitor your USB card reader device;
  2. Link this service with some DLL library in your WinForms app;
  3. If any activity will be detected, call proper method in linked DLL library and do all requested operations.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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