开发者

Delphi - alternative solution for a global keyboard hook

开发者 https://www.devze.com 2023-01-13 00:56 出处:网络
sorry for this little bit strange title, didn\'t found a better one.. I\'ve got the following situation:

sorry for this little bit strange title, didn't found a better one.. I've got the following situation:

I have a PC with an RFID reader connected via USB. I now 开发者_StackOverflowneed a program which pops up when ab transponder was scanned the the RFID reader and shows the scanned value. (The reader just simulates keystrokes) Problem: the value of the transponder is something like 0001230431, and I can't change it. (To prefix a hotkey combination or so)

So I have thought about using a global keyboard hook, check if three zeros where typed in, capture rest of data and when the 10 digits are complete, call the application through an automation object and show the number. But I'm not very exalted about using a global keyboard hook. Many AV programs don't like them very much, they are not so easy to handle with Delphi and I guess that's not very resource-friendly for such a little task...

So I'm looking for an alternative solution...maybe somebody has an idea? Big thx!


ben, you can use the RegisterRawInputDevices and GetRawInputData functions.

first you must use the RegisterRawInputDevices function to register the input device to monitor and then you can retrieves the data from the input device using the GetRawInputData function.

Check theses functions too

  • GetRawInputDeviceList retrieves the list of input devices attached to the system.
  • GetRawInputDeviceInfo retrieves information on a device.


Why not make sure the Delphi app with a text edit control has focus before the scan is done? Then the keystrokes will go straight into your Delphi app.

0

精彩评论

暂无评论...
验证码 换一张
取 消