Intercepting All Application-Wide Keydown Events
Posted on 2009-05-08
I have an application that periodically accepts barcode scanner data from a hand scanner. The data comes in the USB port, but appears to the application just as typed data, i.e. keydown events of character data. When the application is expecting scanned data, I would like to intercept all keydown events at the application level so that all keydown data is evaluated to determine if it matches the expected scan, so that I can inform the user of either "bad scan" or forward the scanned data on to on of three (3) label display on a particular Topmost form, depending on the content of the scan. So even if a user begins to physically type into a textbox on a form, I would like to first intercept the keydown events so as to check them, and if determined not to be the expected scans, allow them to go on to the user's intended textbox.
How would this be implemented on an application-wide basis ?
A fallback position would be if this is not possible on an application wide basis, how would it be implemented on just a form-wide basis ?
Thanks in advance. Any reference to web-site articles, application methods, form methods, etc would be greatly appreciated.