title: Reading data from a barcode scanner using global hooks
body: <p>I have an USB barcode scanner and I created a reader with java, using this library: 
  <a href="https://github.com/kwhat/jnativehook" rel="nofollow noreferrer">https://github.com/kwhat/jnativehook</a></p>
  
  <p>My reader uses global hooks and detects when the data comes from the barcode scanner based on the speed it is typed. This is actually very accurate.
  This reader works in background. When I read any barcode is does some stuff with it and registers some values (that are not relevant for the question) on a database.</p>
  
  <p>It happens that with the hooks, when I scan something they keys events are caught by the focused program (chrome, word, etc) and the numbers on the barcode are displayed on it. This is really annoying if you are trying to write a document or something while another person is using the scanner.</p>
  
  <p>Is there anyway, using this or another java library to prevent the keyboard events from propagate? 
  I want to catch all keyboard events, consume them, and if my application detects they are not coming from the barcode scanner then it would re-create the event and send it to the other programs to catch.</p>
  
  <p>Thanks. </p>