I have an exceedingly simple USB device. There is no driver provided and instructions are to open an editor and manpulate the device (let’s not confuse the issure by dicussing the device) to see the result.
Sure enough, if I open Notepad in Windows and manipulate the device a text string appears in Notepad.
Ok, it looks like it is writing to stdin. Now I would like to write a Delphi program to take this input and act upon it …
How should I best go about it?
The form doesn’t seem to be receiving KeyDown/KeyUp/KeyPress events. That’s a pity as it would allow the device to ‘interrupt’ me. But, maybe I have to poll? Every so often (how often?) I could attempt read from stdin – but what if there is nothing to read?
I hope that I explained that clearly. Any advice?
Update: oops, my bad – I wasn’t receiving KeyDown/KeyUp/KeyPress events because I forgot to set the form’s KeyPreview to True. But I am awarding the question to Greg because he tried to help and because HID looks interesting. Thanks, Greg.
It sounds like your device is using the HID (Human Interface Device) USB class and is acting like a keyboard. So, you would read from the keyboard exactly as you normally would, manipulate the device in whatever way is appropriate (scan a bar code, whatever) and the keystrokes will come through as if they were typed.